# PublicKeyProps

Properties for creating a Public Key.

Used as props by: [PublicKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.PublicKey.html)

- Source: [`aws-cloudfront/lib/public-key.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-cloudfront/lib/public-key.ts#L24)

## Example

TypeScript:

```ts
// Create a key group to use with CloudFront signed URLs and signed cookies.
new cloudfront.KeyGroup(this, 'MyKeyGroup', {
  items: [
    new cloudfront.PublicKey(this, 'MyPublicKey', {
      encodedKey: '...', // contents of public_key.pem file
      // comment: 'Key is expiring on ...',
    }),
  ],
  // comment: 'Key group containing public keys ...',
});
```

Python:

```python
# Create a key group to use with CloudFront signed URLs and signed cookies.
cloudfront.KeyGroup(self, "MyKeyGroup",
    items=[
        cloudfront.PublicKey(self, "MyPublicKey",
            encoded_key="..."
        )
    ]
)
```

Java:

```java
// Create a key group to use with CloudFront signed URLs and signed cookies.
// Create a key group to use with CloudFront signed URLs and signed cookies.
KeyGroup.Builder.create(this, "MyKeyGroup")
        .items(List.of(
            PublicKey.Builder.create(this, "MyPublicKey")
                    .encodedKey("...")
                    .build()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// Create a key group to use with CloudFront signed URLs and signed cookies.
// Create a key group to use with CloudFront signed URLs and signed cookies.
new KeyGroup(this, "MyKeyGroup", new KeyGroupProps {
    Items = new [] {
        new PublicKey(this, "MyPublicKey", new PublicKeyProps {
            EncodedKey = "..."
        }) }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Create a key group to use with CloudFront signed URLs and signed cookies.
// Create a key group to use with CloudFront signed URLs and signed cookies.
cloudfront.NewKeyGroup(this, jsii.String("MyKeyGroup"), &KeyGroupProps{
	Items: []IPublicKeyRef{
		cloudfront.NewPublicKey(this, jsii.String("MyPublicKey"), &PublicKeyProps{
			EncodedKey: jsii.String("..."),
		}),
	},
})
```

## Properties

- `comment`: string — A comment to describe the public key.

  **Default:** no comment

- `encodedKey`: string (required) — The public key that you can use with signed URLs and signed cookies, or with field-level encryption.

  The `encodedKey` parameter must include `-----BEGIN PUBLIC KEY-----` and `-----END PUBLIC KEY-----` lines.

- `publicKeyName`: string — A name to identify the public key.

  **Default:** generated from the `id`
