in pkg/plugin/keyvault.go [235:271]
func (kvc *KeyVaultClient) validateAnnotations(
annotations map[string][]byte,
keyID string,
encryptionAlgorithm kv.JSONWebKeyEncryptionAlgorithm,
) error {
if len(annotations) == 0 {
return fmt.Errorf("invalid annotations, annotations cannot be empty")
}
if keyID != kvc.keyIDHash {
return fmt.Errorf(
"key id %s does not match expected key id %s used for encryption",
keyID,
kvc.keyIDHash,
)
}
algorithm := string(annotations[algorithmAnnotationKey])
if algorithm != string(encryptionAlgorithm) {
return fmt.Errorf(
"algorithm %s does not match expected algorithm %s used for encryption",
algorithm,
encryptionAlgorithm,
)
}
version := string(annotations[versionAnnotationKey])
if version != encryptionResponseVersion {
return fmt.Errorf(
"version %s does not match expected version %s used for encryption",
version,
encryptionResponseVersion,
)
}
return nil
}