Existing keys can be used, but should be checked with <filename>doc/head/share/pgpkeys/checkkey.sh</filename> first. In this case, make sure the key has a FreeBSD user ID.
For those who do not yet have an Open<acronym>PGP</acronym> key, or need a new key to meet FreeBSD security requirements, here we show how to generate one.
Install <filename role="package">security/gnupg</filename>. Enter these lines in <filename>~/.gnupg/gpg.conf</filename> to set minimum acceptable defaults:
personal-digest-preferences SHA512 SHA384 SHA256 SHA224
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 BZIP2 ZLIB ZIP Uncompressed
Generate a key:
<prompt>%</prompt> <userinput>gpg --full-gen-key</userinput>
gpg (GnuPG) 2.1.8; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Warning: using insecure memory!
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection? <userinput>1</userinput>
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) <userinput>2048</userinput> <co xml:id="co-pgp-bits"/>
Requested keysize is 2048 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0) <userinput>3y</userinput> <co xml:id="co-pgp-expire"/>
Key expires at Wed Nov 4 17:20:20 2015 MST
Is this correct? (y/N) <userinput>y</userinput>
GnuPG needs to construct a user ID to identify your key.
Real name: <userinput><replaceable>Chucky Daemon</replaceable></userinput> <co xml:id="co-pgp-realname"/>
Email address: <userinput><replaceable>firstname.lastname@example.org</replaceable></userinput>
You selected this USER-ID:
"<replaceable>Chucky Daemon <email@example.com></replaceable>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? <userinput>o</userinput>
You need a Passphrase to protect your secret key.
2048-bit keys with a three-year expiration provide adequate protection at present (2013-12). <link xlink:href="http://danielpocock.com/rsa-key-sizes-2048-or-4096-bits"/> describes the situation in more detail.
A three year key lifespan is short enough to obsolete keys weakened by advancing computer power, but long enough to reduce key management problems.
Use your real name here, preferably matching that shown on government-issued <acronym>ID</acronym> to make it easier for others to verify your identity. Text that may help others identify you can be entered in the <literal>Comment</literal> section.
After the email address is entered, a passphrase is requested. Methods of creating a secure passphrase are contentious. Rather than suggest a single way, here are some links to sites that describe various methods: <link xlink:href="http://world.std.com/~reinhold/diceware.html"/>, <link xlink:href="http://www.iusmentis.com/security/passphrasefaq/"/>, <link xlink:href="http://xkcd.com/936/"/>, <link xlink:href="http://en.wikipedia.org/wiki/Passphrase"/>.
Protect the private key and passphrase. If either the private key or passphrase may have been compromised or disclosed, immediately notify <email>accounts@FreeBSD.org</email> and revoke the key.