# Cloud KMS V1 Client - Class GetPublicKeyRequest (2.9.0)

2.9.0 (latest) 2.8.0 2.7.0 2.6.0 2.5.2 2.4.0 2.3.1 2.2.0 2.1.6 2.0.0 1.23.0 1.22.1 1.21.4 1.20.3 1.19.0 1.18.1 1.17.0 1.16.4 1.15.3 Reference documentation and code samples for the Cloud KMS V1 Client class GetPublicKeyRequest.

Request message for
[KeyManagementService.GetPublicKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.Client.KeyManagementServiceClient#_Google_Cloud_Kms_V1_Client_KeyManagementServiceClient__getPublicKey__).

Generated from protobuf message `google.cloud.kms.v1.GetPublicKeyRequest`

## Namespace

Google \\ Cloud \\ Kms \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Required. The [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion#_Google_Cloud_Kms_V1_CryptoKeyVersion__getName__) of the [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) public key to get. |
| `↳ public_key_format` | `int` Optional. The [PublicKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.PublicKey) format specified by the user. This field is required for PQC algorithms. If specified, the public key will be exported through the [public_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.PublicKey#_Google_Cloud_Kms_V1_PublicKey__getPublicKey__) field in the requested format. Otherwise, the [pem](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.PublicKey#_Google_Cloud_Kms_V1_PublicKey__getPem__) field will be populated for non-PQC algorithms, and an error will be returned for PQC algorithms. |

### getName

Required. The [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion#_Google_Cloud_Kms_V1_CryptoKeyVersion__getName__) of the
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) public key to get.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Required. The [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion#_Google_Cloud_Kms_V1_CryptoKeyVersion__getName__) of the
[CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) public key to get.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPublicKeyFormat

Optional. The [PublicKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.PublicKey) format specified
by the user. This field is required for PQC algorithms. If specified, the
public key will be exported through the
[public_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.PublicKey#_Google_Cloud_Kms_V1_PublicKey__getPublicKey__) field in the
requested format. Otherwise, the [pem](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.PublicKey#_Google_Cloud_Kms_V1_PublicKey__getPem__)
field will be populated for non-PQC algorithms, and an error will be
returned for PQC algorithms.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [PublicKeyFormat](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.PublicKey.PublicKeyFormat). |

### setPublicKeyFormat

Optional. The [PublicKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.PublicKey) format specified
by the user. This field is required for PQC algorithms. If specified, the
public key will be exported through the
[public_key](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.PublicKey#_Google_Cloud_Kms_V1_PublicKey__getPublicKey__) field in the
requested format. Otherwise, the [pem](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.PublicKey#_Google_Cloud_Kms_V1_PublicKey__getPem__)
field will be populated for non-PQC algorithms, and an error will be
returned for PQC algorithms.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [PublicKeyFormat](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.PublicKey.PublicKeyFormat). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### static::build

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `string` Required. The [name](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion#_Google_Cloud_Kms_V1_CryptoKeyVersion__getName__) of the [CryptoKeyVersion](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKeyVersion) public key to get. Please see KeyManagementServiceClient::cryptoKeyVersionName() for help formatting this field. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.GetPublicKeyRequest` |   |