public sealed class PublicKey : IMessage<PublicKey>, IEquatable<PublicKey>, IDeepCloneable<PublicKey>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud Key Management Service v1 API class PublicKey.
The public keys for a given
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
[GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
Provided here for verification.
Integrity verification field. A CRC32C checksum of the returned
[PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
[PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
computing the CRC32C checksum of
[PublicKey.pem][google.cloud.kms.v1.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.
Property Value
Type
Description
System.Int64
ProtectionLevel
public ProtectionLevel ProtectionLevel { get; set; }
The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
public PublicKey.Types.PublicKeyFormat PublicKeyFormat { get; set; }
The [PublicKey][google.cloud.kms.v1.PublicKey] format specified by the
customer through the
[public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
field.
This field contains the public key (with integrity verification), formatted
according to the
[public_key_format][google.cloud.kms.v1.PublicKey.public_key_format] field.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis webpage provides documentation for the \u003ccode\u003ePublicKey\u003c/code\u003e class within the Google Cloud Key Management Service v1 API for .NET, which is used for accessing public keys of CryptoKeyVersions.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of \u003ccode\u003ePublicKey\u003c/code\u003e is 3.16.0, with links to documentation for previous versions ranging from 3.15.0 down to 2.2.0.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePublicKey\u003c/code\u003e class implements interfaces like \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, and includes properties for algorithm, name, PEM-encoded key, checksum, protection level, and format.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePublicKey\u003c/code\u003e object represents the public key of a given CryptoKeyVersion and can be obtained via \u003ccode\u003eGetPublicKey\u003c/code\u003e, also supporting verification through the \u003ccode\u003ePemCrc32C\u003c/code\u003e property.\u003c/p\u003e\n"],["\u003cp\u003eThe provided documentation highlights the object inheritance, constructors, properties and the specific types that define the properties and their expected values.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Key Management Service v1 API - Class PublicKey (3.18.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.18.0 (latest)](/dotnet/docs/reference/Google.Cloud.Kms.V1/latest/Google.Cloud.Kms.V1.PublicKey)\n- [3.17.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.17.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.16.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.16.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.15.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.15.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.14.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.14.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.13.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.13.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.12.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.12.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.11.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.11.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.10.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.10.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.9.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.8.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.7.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.6.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.5.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.4.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.3.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.2.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.1.0/Google.Cloud.Kms.V1.PublicKey)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/3.0.0/Google.Cloud.Kms.V1.PublicKey)\n- [2.9.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.9.0/Google.Cloud.Kms.V1.PublicKey)\n- [2.8.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.8.0/Google.Cloud.Kms.V1.PublicKey)\n- [2.7.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.7.0/Google.Cloud.Kms.V1.PublicKey)\n- [2.6.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.6.0/Google.Cloud.Kms.V1.PublicKey)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.5.0/Google.Cloud.Kms.V1.PublicKey)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.4.0/Google.Cloud.Kms.V1.PublicKey)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.3.0/Google.Cloud.Kms.V1.PublicKey)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Kms.V1/2.2.0/Google.Cloud.Kms.V1.PublicKey) \n\n public sealed class PublicKey : IMessage\u003cPublicKey\u003e, IEquatable\u003cPublicKey\u003e, IDeepCloneable\u003cPublicKey\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Key Management Service v1 API class PublicKey.\n\nThe public keys for a given\n\\[CryptoKeyVersion\\]\\[google.cloud.kms.v1.CryptoKeyVersion\\]. Obtained via\n\\[GetPublicKey\\]\\[google.cloud.kms.v1.KeyManagementService.GetPublicKey\\]. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e PublicKey \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[PublicKey](/dotnet/docs/reference/Google.Cloud.Kms.V1/latest/Google.Cloud.Kms.V1.PublicKey), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[PublicKey](/dotnet/docs/reference/Google.Cloud.Kms.V1/latest/Google.Cloud.Kms.V1.PublicKey), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[PublicKey](/dotnet/docs/reference/Google.Cloud.Kms.V1/latest/Google.Cloud.Kms.V1.PublicKey), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Kms.V1](/dotnet/docs/reference/Google.Cloud.Kms.V1/latest/Google.Cloud.Kms.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Kms.V1.dll\n\nConstructors\n------------\n\n### PublicKey()\n\n public PublicKey()\n\n### PublicKey(PublicKey)\n\n public PublicKey(PublicKey other)\n\nProperties\n----------\n\n### Algorithm\n\n public CryptoKeyVersion.Types.CryptoKeyVersionAlgorithm Algorithm { get; set; }\n\nThe\n\\[Algorithm\\]\\[google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm\\]\nassociated with this key.\n\n### Name\n\n public string Name { get; set; }\n\nThe \\[name\\]\\[google.cloud.kms.v1.CryptoKeyVersion.name\\] of the\n\\[CryptoKeyVersion\\]\\[google.cloud.kms.v1.CryptoKeyVersion\\] public key.\nProvided here for verification.\n\nNOTE: This field is in Beta.\n\n### Pem\n\n public string Pem { get; set; }\n\nThe public key, encoded in PEM format. For more information, see the\n[RFC 7468](https://tools.ietf.org/html/rfc7468) sections for\n[General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and\n[Textual Encoding of Subject Public Key Info](https://tools.ietf.org/html/rfc7468#section-13).\n\n### PemCrc32C\n\n public long? PemCrc32C { get; set; }\n\nIntegrity verification field. A CRC32C checksum of the returned\n\\[PublicKey.pem\\]\\[google.cloud.kms.v1.PublicKey.pem\\]. An integrity check of\n\\[PublicKey.pem\\]\\[google.cloud.kms.v1.PublicKey.pem\\] can be performed by\ncomputing the CRC32C checksum of\n\\[PublicKey.pem\\]\\[google.cloud.kms.v1.PublicKey.pem\\] and comparing your\nresults to this field. Discard the response in case of non-matching\nchecksum values, and perform a limited number of retries. A persistent\nmismatch may indicate an issue in your computation of the CRC32C checksum.\nNote: This field is defined as int64 for reasons of compatibility across\ndifferent languages. However, it is a non-negative integer, which will\nnever exceed `2^32-1`, and can be safely downconverted to uint32 in\nlanguages that support this type.\n\nNOTE: This field is in Beta.\n\n### ProtectionLevel\n\n public ProtectionLevel ProtectionLevel { get; set; }\n\nThe \\[ProtectionLevel\\]\\[google.cloud.kms.v1.ProtectionLevel\\] of the\n\\[CryptoKeyVersion\\]\\[google.cloud.kms.v1.CryptoKeyVersion\\] public key.\n\n### PublicKeyFormat\n\n public PublicKey.Types.PublicKeyFormat PublicKeyFormat { get; set; }\n\nThe \\[PublicKey\\]\\[google.cloud.kms.v1.PublicKey\\] format specified by the\ncustomer through the\n\\[public_key_format\\]\\[google.cloud.kms.v1.GetPublicKeyRequest.public_key_format\\]\nfield.\n\n### PublicKeyName\n\n public PublicKeyName PublicKeyName { get; set; }\n\n[PublicKeyName](/dotnet/docs/reference/Google.Cloud.Kms.V1/latest/Google.Cloud.Kms.V1.PublicKeyName)-typed view over the [Name](/dotnet/docs/reference/Google.Cloud.Kms.V1/latest/Google.Cloud.Kms.V1.PublicKey#Google_Cloud_Kms_V1_PublicKey_Name) resource name property.\n\n### PublicKey_\n\n public ChecksummedData PublicKey_ { get; set; }\n\nThis field contains the public key (with integrity verification), formatted\naccording to the\n\\[public_key_format\\]\\[google.cloud.kms.v1.PublicKey.public_key_format\\] field."]]