fix(aes-encryption): update docs

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
This commit is contained in:
ivan katliarchuk 2024-12-29 14:57:02 +00:00
parent 0786e67bec
commit b711ceb4bf
No known key found for this signature in database
GPG Key ID: 601CDBBBB76E47BE

View File

@ -86,6 +86,13 @@ func main() {
for _, k := range keys { for _, k := range keys {
key := []byte(k) key := []byte(k)
if len(key) != 32 {
// if key is not a plain txt let's decode
var err error
if key, err = b64.StdEncoding.DecodeString(string(key)); err != nil || len(key) != 32 {
fmt.Errorf("the AES Encryption key must have a length of 32 byte")
}
}
encrypted, _ := endpoint.EncryptText( encrypted, _ := endpoint.EncryptText(
"heritage=external-dns,external-dns/owner=example,external-dns/resource=ingress/default/example", "heritage=external-dns,external-dns/owner=example,external-dns/resource=ingress/default/example",
key, key,