# PublicKey

- [JSON representation](https://docs.cloud.google.com/certificate-authority-service/docs/reference/rest/v1beta1/PublicKey#SCHEMA_REPRESENTATION)
- [KeyType](https://docs.cloud.google.com/certificate-authority-service/docs/reference/rest/v1beta1/PublicKey#KeyType)

A `https://docs.cloud.google.com/certificate-authority-service/docs/reference/rest/v1beta1/PublicKey` describes a public key.

| JSON representation ||
|---|---|
| ``` { "type": enum (`https://docs.cloud.google.com/certificate-authority-service/docs/reference/rest/v1beta1/PublicKey#KeyType`), "key": string } ``` |

| Fields ||
|---|---|
| `type` | ``enum (`https://docs.cloud.google.com/certificate-authority-service/docs/reference/rest/v1beta1/PublicKey#KeyType`)`` Optional. The type of public key. If specified, it must match the public key used for the`key` field. |
| `key` | `string (https://developers.google.com/discovery/v1/type-format format)` Required. A public key. When this is specified in a request, the padding and encoding can be any of the options described by the respective 'KeyType' value. When this is generated by the service, it will always be an RFC 5280 [SubjectPublicKeyInfo](https://tools.ietf.org/html/rfc5280#section-4.1) structure containing an algorithm identifier and a key. A base64-encoded string. |

## KeyType

Types of public keys that are supported. At a minimum, we support RSA and ECDSA, for the key sizes or curves listed: <https://cloud.google.com/kms/docs/algorithms#asymmetric_signing_algorithms>

| Enums ||
|---|---|
| `KEY_TYPE_UNSPECIFIED` | Default unspecified value. |
| `PEM_RSA_KEY` | A PEM-encoded PKCS#1/RFC 3447 RSAPublicKey structure, or an RFC 5280 [SubjectPublicKeyInfo](https://tools.ietf.org/html/rfc5280#section-4.1) structure containing the former. |
| `PEM_EC_KEY` | An RFC 5280 [SubjectPublicKeyInfo](https://tools.ietf.org/html/rfc5280#section-4.1) structure containing a PEM-encoded compressed NIST P-256/secp256r1/prime256v1 or P-384 key. |