I'm using Google Secret Manager for the first time to store some binary data. When I access the secret, it seems to have a different encoding or format.
The actual data is a certificate bundle, but I've been able to reproduce the issue using smaller binary data. Steps to reproduce:
Create a file with binary data:
echo -e -n '\xed\xfe' > secret.txt
Create the secret and version:
gcloud secrets create "my-secret" \ --data-file ./secret.txt \ --replication-policy "automatic"
Access the secret and save the result to a file:
gcloud secrets versions access latest --secret "my-secret" > result.txt
Compare the two files:
od -t x1 secret.txt # ed fe od -t x1 result.txt # 3f 3f 0a
Why is the result different? Do I have to do something extra to get Google Secret Manager to work with binary data?