Code Monkey home page Code Monkey logo

gpg-keys's Introduction

GPG Key creation

Generate a primary keypair for an identity

gpg --expert --full-generate-key

Select RSA (set your own capabilities).

Toggle sign and encrypt OFF so the current allowed actions is certify***.

****Create a key length of 4096 bits.

Provide an expiry date (3y).

Finish creating with name and email.

Add subkeys

Add shorterlived subkeys for sign, encryption and authenticate.

gpg --export --edit-key [email protected]

The prompt will change to gpg>.

The addkey command is used to create each subkey. Choose the option for RSA (set your own capabilities).

Use a smaller length of 3072 to reduce size of the key.

After all three subkeys are created use the save command to exit.

Add a picture

You can also at this point add a small image tothey key, but I won't cover that.

Export the secret

gpg --export-secret-key --armor [email protected] > \<[email protected]\>.private.gpg-key

Create a revocation certificate

gpg --armor --gen-revoke [email protected] > \<[email protected]\>.gpg-revocation-certificate

Create qr codes

Use the ./printkey.sh script to take a key, split it up and create a qrcode for each part. Print these out and store them safely.

Test scanned keypair

Run the following command to ensure the crc of the keypair is good. gpg --dearmor newkey >/dev/null

If the key is already exported we can diff the files:

diff input <[email protected]>

Remove the primary key

Check the output of gpg --list-secret-keys

gpg --export-secret-subkeys --armor [email protected] > \<[email protected]\>.subkeys.gpg-key
gpg --delete-secret-keys [email protected]
gpg --import \<[email protected]\>.subkeys.gpg-key

Now look at the output of gpg --list-secret-keys it should say #sec in the first key. This means that the signing key is not in the keypair.

Now shred -z -u $file any exported files.

Move to another system

gpg --export-secret-keys --armor [email protected] > \<[email protected]\>.laptop.private.gpg-key gpg --export --armor [email protected] > \<[email protected]\>.laptop.public.gpg-key

Then on the new system

gpg --import \<[email protected]\>.laptop.public.gpg-key gpg --import \<[email protected]\>.laptop.private.gpg-key

Restoring

Scan each barcode into a file:

zbarcam --raw >> inputkey

verify the CRC with

gpg --dearmor inputkey >/dev/null

After scanning there might be a 0x0A missing at the end of line 1 and an extra 0x0A at the end of the last line.

Importing to an offline RPI running raspian involves using the loopback pinentry command

gpg --import --pinentry-mode loopback inputkey

Expiring keys

When a key is expiring

gpg --expert --edit-key <key>

key 1

expire

SSH Keys

To export ssh public key

gpg --export-ssh-key [email protected]

and the privatekey

gpg --export-ssh-secret-key [email protected]

Resources

gpg-keys's People

Contributors

cda0 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.