Generating a GPG key in a script

1 · Adrian Ancona Novelo · Dec. 21, 2022, midnight
In this post we are going to learn how to generate a GPG key without having to answer prompts so it can be added to a script if desired. We start by creating a file where we’ll write the details for our key. This will be the content of the file: 1 2 3 4 5 6 7 8 9 10 11 %echo Generating GPG key Key-Type: default Key-Type: RSA Key-Length: 3072 Subkey-Type: RSA Subkey-Length: 3072 Name-Real: Carlos Sanchez Name-Email: [email protected] %no-protection %commit %echo done And then we can use this co...