Skip to content

Instantly share code, notes, and snippets.

@seahrh
Forked from vrillusions/README.mkd
Created April 25, 2019 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seahrh/d08d846205355557c65509ac6bb308fe to your computer and use it in GitHub Desktop.
Save seahrh/d08d846205355557c65509ac6bb308fe 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