<commit_before>---
owner_slack: "#govuk-developers"
title: Create a GPG key
parent: "/manual.html"
layout: manual_layout
section: Accounts
last_reviewed_on: 2020-03-11
review_in: 6 months
---

We use GPG keys to encrypt our secrets. Documentation for using your GPG key can be found [here](/manual/encrypted-hiera-data.html#common-tasks-for-handling-encrypted-hiera-data).

## Prerequisites

Install `gpg` if you don't already have it. Use `brew cask install gpg-suite` to install the graphical [GPG Suite](https://gpgtools.org/).

Once installed, you will likely have both `gpg` and `gpg2` on your machine. Always use `gpg2`.

## Creating a GPG key (using the GUI)

[GPGtools](https://gpgtools.org/) comes with a GUI which can perform most of the operations you need.

To create a new key, click "New". The `Name` field should be your name. For `Length`, you should have at least 4096.

The creation process will give you the option to upload to a public server. Say yes. You can check your key has been uploaded using the Lookup Key button in the GUI.

On the main page which lists all of your keys you can double click your key to get the required details (fingerprint and id).

See below for checking your passphrase.

## Creating a GPG key (using the command line)

Create a gpg key with `gpg2 --gen-key` using your
digital.cabinet-office.gov.uk email address. Defaults for the questions<commit_msg>Review Create a GPG key<commit_after>---
owner_slack: "#govuk-developers"
title: Create a GPG key
parent: "/manual.html"
layout: manual_layout
section: Accounts
last_reviewed_on: 2020-07-15
review_in: 6 months
---

We use GPG keys to encrypt our secrets. Documentation for using your GPG key can be found [here](/manual/encrypted-hiera-data.html#common-tasks-for-handling-encrypted-hiera-data).

## Prerequisites

Install `gpg` if you don't already have it. Use `brew cask install gpg-suite` to install the graphical [GPG Suite](https://gpgtools.org/).

Once installed, you will likely have both `gpg` and `gpg2` on your machine. Always use `gpg2`.

## Creating a GPG key (using the GUI)

[GPGtools](https://gpgtools.org/) comes with a GUI which can perform most of the operations you need.

To create a new key, click "New". The `Name` field should be your name. For `Length`, you should have at least 4096.

The creation process will give you the option to upload to a public server. Say yes. You can check your key has been uploaded using the Lookup Key button in the GUI.

On the main page which lists all of your keys you can double click your key to get the required details (fingerprint and id).

See below for checking your passphrase.

## Creating a GPG key (using the command line)

Create a gpg key with `gpg2 --gen-key` using your
digital.cabinet-office.gov.uk email address. Defaults for the questions
{'fraction_non_alphanumeric': 0.08374733853797019, 'fraction_numerical': 0.0113555713271824, 'mean_word_length': 4.1535648994515535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '657430', 'n_tokens_mistral': 884, 'n_tokens_neox': 829, 'n_words': 407}