# Google Certificate Authority Service V1 Client - Class PublicKey (2.4.0)

2.4.0 (latest) 2.3.0 2.2.2 2.1.1 2.0.3 1.7.3 1.5.0 1.4.2 1.3.1 1.2.2 1.1.0 1.0.3 Reference documentation and code samples for the Google Certificate Authority Service V1 Client class PublicKey.

A [PublicKey](https://docs.cloud.google.com/php/docs/reference/cloud-security-private-ca/latest/V1.PublicKey) describes a
public key.

Generated from protobuf message `google.cloud.security.privateca.v1.PublicKey`

## Namespace

Google \\ Cloud \\ Security \\ PrivateCA \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ key` | `string` Required. A public key. The padding and encoding must match with the `KeyFormat` value specified for the `format` field. |
| `↳ format` | `int` Required. The format of the public key. |

### getKey

Required. A public key. The padding and encoding
must match with the `KeyFormat` value specified for the `format` field.

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

### setKey

Required. A public key. The padding and encoding
must match with the `KeyFormat` value specified for the `format` field.

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

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

### getFormat

Required. The format of the public key.

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

### setFormat

Required. The format of the public key.

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

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