Environmental info: python code with gnupg to encrypt file with public key and recipient, running in azure function app on Linux based OS. In an event based architecture, daily 1000's of files are encrypted and saved to azure storage. Multiple public keys are available to choose from based on criteria.
Issue:
Consider there are three publickey with recipients namely recipient1, recipient2, recipient3
After running successfully for months, when we try to add new "recipient4". The new publickey always fails with error "invalid public key" even though public key is valid.
In this situation we delete the function app and recreate the resource again in Azure. Now all 4 recipients work perfectly fine.
Same issue repeats when we add new recipient5.
Debugged information:
in bash I checked the .gnupg/ location and found the pubring.ksc file. While checking new recipients are not reflected in the file.
Restarting the function app won't help as gpg software in Linux is not affected as part of the function app re-start (only recreation of environment helps)
Kindly help me in the right direction to understand better the situation
Instead of recreating a Function App again, Generate a new key separately for recipient4 in the Function App > Kudu > SSH and then encrypt and decrypt it.
I have visited > Function App > Advanced Tools > Go > SSH >
And ran the commands below:-
Output:-
Recipient 4 file encrypted and decrypted correctly, After I added a new key:-