| 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/kms/apis/v2"; |
| 22 |
|
| 23 |
// This service defines the public APIs for remote KMS provider. |
| 24 |
service KeyManagementService { |
| 25 |
// this API is meant to be polled |
| 26 |
rpc Status(StatusRequest) returns (StatusResponse) {} |
| 27 |
|
| 28 |
// Execute decryption operation in KMS provider. |
| 29 |
rpc Decrypt(DecryptRequest) returns (DecryptResponse) {} |
| 30 |
// Execute encryption operation in KMS provider. |
| 31 |
rpc Encrypt(EncryptRequest) returns (EncryptResponse) {} |
| 32 |
} |
| 33 |
|
| 34 |
message StatusRequest {} |
| 35 |
|
| 36 |
message StatusResponse { |
| 37 |
// Version of the KMS gRPC plugin API. Must equal v2 to v2beta1 (v2 is recommended, but both are equivalent). |
| 38 |
string version = 1; |
| 39 |
// Any value other than "ok" is failing healthz. On failure, the associated API server healthz endpoint will contain this value as part of the error message. |
| 40 |
string healthz = 2; |
| 41 |
// the current write key, used to determine staleness of data updated via value.Transformer.TransformFromStorage. |
| 42 |
// keyID must satisfy the following constraints: |
| 43 |
// 1. The keyID is not empty. |
| 44 |
// 2. The size of keyID is less than 1 kB. |
| 45 |
string key_id = 3; |
| 46 |
} |
| 47 |
|
| 48 |
message DecryptRequest { |
| 49 |
// The data to be decrypted. |
| 50 |
bytes ciphertext = 1; |
| 51 |
// UID is a unique identifier for the request. |
| 52 |
string uid = 2; |
| 53 |
// The keyID that was provided to the apiserver during encryption. |
| 54 |
// This represents the KMS KEK that was used to encrypt the data. |
| 55 |
string key_id = 3; |
| 56 |
// Additional metadata that was sent by the KMS plugin during encryption. |
| 57 |
map<string, bytes> annotations = 4; |
| 58 |
} |
| 59 |
|
| 60 |
message DecryptResponse { |
| 61 |
// The decrypted data. |
| 62 |
bytes plaintext = 1; |
| 63 |
} |
| 64 |
|
| 65 |
message EncryptRequest { |
| 66 |
// The data to be encrypted. |
| 67 |
bytes plaintext = 1; |
| 68 |
// UID is a unique identifier for the request. |
| 69 |
string uid = 2; |
| 70 |
} |
| 71 |
|
| 72 |
message EncryptResponse { |
| 73 |
// The encrypted data. |
| 74 |
// ciphertext must satisfy the following constraints: |
| 75 |
// 1. The ciphertext is not empty. |
| 76 |
// 2. The ciphertext is less than 1 kB. |
| 77 |
bytes ciphertext = 1; |
| 78 |
// The KMS key ID used to encrypt the data. This must always refer to the KMS KEK and not any local KEKs that may be in use. |
| 79 |
// This can be used to inform staleness of data updated via value.Transformer.TransformFromStorage. |
| 80 |
// keyID must satisfy the following constraints: |
| 81 |
// 1. The keyID is not empty. |
| 82 |
// 2. The size of keyID is less than 1 kB. |
| 83 |
string key_id = 2; |
| 84 |
// Additional metadata to be stored with the encrypted data. |
| 85 |
// This data is stored in plaintext in etcd. KMS plugin implementations are responsible for pre-encrypting any sensitive data. |
| 86 |
// Annotations must satisfy the following constraints: |
| 87 |
// 1. Annotation key must be a fully qualified domain name that conforms to the definition in DNS (RFC 1123). |
| 88 |
// 2. The size of annotations keys + values is less than 32 kB. |
| 89 |
map<string, bytes> annotations = 3; |
| 90 |
} |