Skip to content

Commit af75826

Browse files
authored
Merge pull request kubernetes#3455 from aramase/update-kms-kep0
update EncryptedObject struct in kms v2
2 parents 2edd6f7 + cb26a83 commit af75826

File tree

1 file changed

+10
-16
lines changed
  • keps/sig-auth/3299-kms-v2-improvements

1 file changed

+10
-16
lines changed

keps/sig-auth/3299-kms-v2-improvements/README.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,25 +196,19 @@ message EncryptRequest {
196196
}
197197
```
198198

199-
In terms of storage, a new structured protobuf format is proposed. Similar to the proto serializer, it will use a magic number to detect when the stored data is in a format that it understands:
200-
201-
```go
202-
encryptedProtoEncodingPrefix = []byte{'e', 'k', '8', 's', 0}
203-
```
204-
205-
The last byte represents the encoding style, with 0 meaning that the rest of the byte stream is a proto message of type `EncryptedObject`:
199+
In terms of storage, a new structured protobuf format is proposed. The prefix for the new format is `k8s:enc:kms:v2:<config name>:`.
206200

207201
```go
202+
// EncryptedObject is the representation of data stored in etcd after envelope encryption.
208203
type EncryptedObject struct {
209-
TypeMeta `json:",inline" protobuf:"bytes,1,opt,name=typeMeta"`
210-
// KeyID is the KMS key ID used for encryption operations.
211-
KeyID string `protobuf:"bytes,2,opt,name=keyID"`
212-
// PluginName is the name of the KMS plugin used for encryption.
213-
PluginName string `protobuf:"bytes,3,opt,name=pluginName"`
214-
// Ciphertext is the encrypted DEK.
215-
Ciphertext []byte `protobuf:"bytes,4,opt,name=ciphertext"`
216-
// Annotations is additional metadata that was provided by the KMS plugin.
217-
Annotations map[string][]byte `protobuf:"bytes,5,opt,name=annotations"`
204+
// EncryptedData is the encrypted data.
205+
EncryptedData []byte `protobuf:"bytes,1,opt,name=encryptedData,proto3" json:"encryptedData,omitempty"`
206+
// KeyID is the KMS key ID used for encryption operations.
207+
KeyID string `protobuf:"bytes,2,opt,name=keyID,proto3" json:"keyID,omitempty"`
208+
// EncryptedDEK is the encrypted DEK.
209+
EncryptedDEK []byte `protobuf:"bytes,3,opt,name=encryptedDEK,proto3" json:"encryptedDEK,omitempty"`
210+
// Annotations is additional metadata that was provided by the KMS plugin.
211+
Annotations map[string][]byte `protobuf:"bytes,4,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
218212
}
219213
```
220214

0 commit comments

Comments
 (0)