# Class PublicKey (3.14.0)

3.14.0 (latest) 3.13.0 3.12.0 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.1 3.4.0 3.3.1 3.2.2 3.1.1 3.0.0 2.24.2 2.23.0 2.22.0 2.21.4 2.20.0 2.19.2 2.18.0 2.17.0 2.16.1 2.15.0 2.14.1 2.13.0 2.12.3 2.11.2 2.10.1 2.9.0 2.8.0 2.7.0 2.6.1 2.5.0 2.4.3 2.3.0 2.2.0 2.1.0 2.0.1 1.4.2 1.3.0 1.2.1 1.1.0

    PublicKey(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The public keys for a given
CryptoKeyVersion. Obtained
via
GetPublicKey.

| ## Attributes ||
|---|---|
| **Name** | **Description** |
| `pem` | `str` The public key, encoded in PEM format. For more information, see the `RFC 7468 `__ sections for \`General Considerations |
| `algorithm` | `https://docs.cloud.google.com/python/docs/reference/cloudkms/latest/google.cloud.kms_v1.types.CryptoKeyVersion.CryptoKeyVersionAlgorithm` The Algorithm associated with this key. |
| `pem_crc32c` | `google.protobuf.wrappers_pb2.Int64Value` Integrity verification field. A CRC32C checksum of the returned PublicKey.pem. An integrity check of PublicKey.pem can be performed by computing the CRC32C checksum of PublicKey.pem and comparing your results to this field. Discard the response in case of non-matching checksum values, and perform a limited number of retries. A persistent mismatch may indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across different languages. However, it is a non-negative integer, which will never exceed `2^32-1`, and can be safely downconverted to uint32 in languages that support this type. NOTE: This field is in Beta. |
| `name` | `str` The name of the CryptoKeyVersion public key. Provided here for verification. NOTE: This field is in Beta. |
| `protection_level` | `https://docs.cloud.google.com/python/docs/reference/cloudkms/latest/google.cloud.kms_v1.types.ProtectionLevel` The ProtectionLevel of the CryptoKeyVersion public key. |
| `public_key_format` | `https://docs.cloud.google.com/python/docs/reference/cloudkms/latest/google.cloud.kms_v1.types.PublicKey.PublicKeyFormat` The PublicKey format specified by the customer through the public_key_format field. |
| `public_key` | `https://docs.cloud.google.com/python/docs/reference/cloudkms/latest/google.cloud.kms_v1.types.ChecksummedData` This field contains the public key (with integrity verification), formatted according to the public_key_format field. |

## Classes

### PublicKeyFormat

    PublicKeyFormat(value)

The supported PublicKey formats.

        - For PQC algorithms, an error will be returned.
        - For non-PQC algorithms, the default format is PEM, and the
          field <xref uid="google.cloud.kms.v1.PublicKey.pem">pem</xref> will be
          populated.

        Otherwise, the public key will be exported through the
        <xref uid="google.cloud.kms.v1.PublicKey.public_key">public_key</xref> field
        in the requested format.
    PEM (1):
        The returned public key will be encoded in PEM format. See
        the `RFC7468 <https://tools.ietf.org/html/rfc7468>`__
        sections for `General
        Considerations <https://tools.ietf.org/html/rfc7468#section-2>`__
        and [Textual Encoding of Subject Public Key Info]
        (https://tools.ietf.org/html/rfc7468#section-13) for more
        information.
    DER (2):
        The returned public key will be encoded in
        DER format (the PrivateKeyInfo structure from
        RFC 5208).
    NIST_PQC (3):
        This is supported only for PQC algorithms.
        The key material is returned in the format
        defined by NIST PQC standards (FIPS 203, FIPS
        204, and FIPS 205).
    XWING_RAW_BYTES (4):
        The returned public key is in raw bytes
        format defined in its standard
        https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem.