| 1 |
/* |
| 2 |
Copyright 2022 The Kubernetes Authors. |
| 3 |
|
| 4 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
you may not use this file except in compliance with the License. |
| 6 |
You may obtain a copy of the License at |
| 7 |
|
| 8 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
|
| 10 |
Unless required by applicable law or agreed to in writing, software |
| 11 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
See the License for the specific language governing permissions and |
| 14 |
limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
// To regenerate api.pb.go run `hack/update-codegen.sh protobindings` |
| 18 |
syntax = "proto3"; |
| 19 |
|
| 20 |
package v2; |
| 21 |
option go_package = "k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/v2"; |
| 22 |
|
| 23 |
// EncryptedObject is the representation of data stored in etcd after envelope encryption. |
| 24 |
message EncryptedObject { |
| 25 |
// EncryptedData is the encrypted data. |
| 26 |
bytes encryptedData = 1; |
| 27 |
|
| 28 |
// KeyID is the KMS key ID used for encryption operations. |
| 29 |
// keyID must satisfy the following constraints: |
| 30 |
// 1. The keyID is not empty. |
| 31 |
// 2. The size of keyID is less than 1 kB. |
| 32 |
string keyID = 2; |
| 33 |
|
| 34 |
// EncryptedDEKSource is the ciphertext of the source of the DEK used to encrypt the data stored in encryptedData. |
| 35 |
// encryptedDEKSourceType defines the process of using the plaintext of this field to determine the aforementioned DEK. |
| 36 |
// encryptedDEKSource must satisfy the following constraints: |
| 37 |
// 1. The encrypted DEK source is not empty. |
| 38 |
// 2. The size of encrypted DEK source is less than 1 kB. |
| 39 |
bytes encryptedDEKSource = 3; |
| 40 |
|
| 41 |
// Annotations is additional metadata that was provided by the KMS plugin. |
| 42 |
// Annotations must satisfy the following constraints: |
| 43 |
// 1. Annotation key must be a fully qualified domain name that conforms to the definition in DNS (RFC 1123). |
| 44 |
// 2. The size of annotations keys + values is less than 32 kB. |
| 45 |
map<string, bytes> annotations = 4; |
| 46 |
|
| 47 |
// encryptedDEKSourceType defines the process of using the plaintext of encryptedDEKSource to determine the DEK. |
| 48 |
EncryptedDEKSourceType encryptedDEKSourceType = 5; |
| 49 |
} |
| 50 |
|
| 51 |
enum EncryptedDEKSourceType { |
| 52 |
// AES_GCM_KEY means that the plaintext of encryptedDEKSource is the DEK itself, with AES-GCM as the encryption algorithm. |
| 53 |
AES_GCM_KEY = 0; |
| 54 |
|
| 55 |
// HKDF_SHA256_XNONCE_AES_GCM_SEED means that the plaintext of encryptedDEKSource is the pseudo random key |
| 56 |
// (referred to as the seed throughout the code) that is fed into HKDF expand. SHA256 is the hash algorithm |
| 57 |
// and first 32 bytes of encryptedData are the info param. The first 32 bytes from the HKDF stream are used |
| 58 |
// as the DEK with AES-GCM as the encryption algorithm. |
| 59 |
HKDF_SHA256_XNONCE_AES_GCM_SEED = 1; |
| 60 |
} |