Skip to content

Instantly share code, notes, and snippets.

@vrillusions
Created April 29, 2013 20:15
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save vrillusions/5484422 to your computer and use it in GitHub Desktop.
Save vrillusions/5484422 to your computer and use it in GitHub Desktop.
Generate gpg key via batch file

Introduction

This is how to create a gpg key without any user interaction or password. This can be used in cases where the primary goal is to secure the data in transit but the gpg key can/must be stored locally without a password. An example of this is the hiera-gpg plugin which doesn't support passwords.

The below genkey-batch file will use the default which currently are RSA/RSA and 2048 bit length. See the reference link to set this to something else.

References

%no-protection
Key-Type: default
Subkey-Type: default
Name-Real: YOUR NAME
Name-Email: YOUR EMAIL@example.com
Expire-Date: 0
gpg --batch --gen-key genkey-batch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment