DNSSEC-KEYGEN(8) BIND9 Programmer's Manual DNSSEC-KEYGEN(8) NAME dnssec-keygen - key generation tool for DNSSEC SYNOPSIS dnssec-keygen -a algorithm -b keysize [-c class] [-e] [-g generator] [-h] -n nametype [-p protocol-value] [-r randomdev] [-s strength-value] [-t type] [-v level] name DESCRIPTION dnssec-keygen generates keys for DNSSEC, Secure DNS, as defined in RFC2535. It also generates keys for use in Transaction Signatures, TSIG, which is defined in RFC2845. A short summary of the options and arguments to dnssec-keygen is printed by the -h (help) option. The -a, -b, and -n options and their arguments must be supplied when gen- erating keys. The domain name that the key has to be generated for is given by name. The choice of encryption algorithm is selected by the -a option to dnssec-keygen. algorithm must be one of RSAMD5, DH, DSA or HMAC-MD5 to indicate that an RSA, Diffie-Hellman, Digital Signature Algorithm or HMAC-MD5 key is required. An argument of RSA can also be given, which is equivalent to RSAMD5. The argument identifying the encryption algorithm is case-insensitive. DNSSEC specifies DSA as a mandatory algorithm and RSA as a recommended one. Implementations of TSIG must support HMAC-MD5. The number of bits in the key is determined by the keysize argument fol- lowing the -b option. The choice of key size depends on the algorithm that is used. RSA keys must be between 512 and 2048 bits. Diffie-Hell- man keys must be between 128 and 4096 bits. For DSA, the key size must be between 512 and 1024 bits and a multiple of 64. The length of an HMAC-MD5 key can be between 1 and 512 bits. The -n option specifies how the generated key will be used. nametype can be either ZONE, HOST, ENTITY, or USER to indicate that the key will be used for signing a zone, host, entity or user respectively. In this con- text HOST and ENTITY are identical. nametype is case-insensitive. The -c option specifies that the when creating a KEY record, the speci- fied class should be used instead of IN. The -e option can only be used when generating RSA keys. It tells dnssec-keygen to use a large exponent. When creating Diffie-Hellman keys, the -g option selects the Diffie-Hellman generator generator that is to be used. The only supported values value of generator are 2 and 5. If no Diffie-Hellman generator is supplied, a known prime from RFC2539 will be used if possible; otherwise 2 will be used as the generator. The -p option sets the protocol value for the generated key to protocol- value. The default is 2 (email) for keys of type USER and 3 (DNSSEC) for all other key types. Other possible values for this argument are listed in RFC2535 and its successors. dnssec-keygen uses random numbers to seed the process of generating keys. If the system does not have a /dev/random device that can be used for generating random numbers, dnssec-keygen will prompt for keyboard input and use the time intervals between keystrokes to provide randomness. The -r option overrides this behaviour, making dnssec-keygen use randomdev as a source of random data. The key's strength value can be set with the -s option. The generated key will sign DNS resource records with a strength value of strength- value. It should be a number between 0 and 15. The default strength is zero. The key strength field currently has no defined purpose in DNSSEC. The -t option indicates if the key is to be used for authentication or confidentiality. type can be one of AUTHCONF, NOAUTHCONF, NOAUTH or NOCONF. The default is AUTHCONF. If type is AUTHCONF the key can be used for authentication and confidentialty. Setting type to NOAUTHCONF indi- cates that the key cannot be used for authentication or confidentialty. A value of NOAUTH means the key can be used for confidentiality but not for authentication. Similarly, NOCONF defines that the key cannot be used for confidentiality though it can be used for authentication. The -v option can be used to make dnssec-keygen more verbose. As the de- bugging/tracing level level increases, dnssec-keygen generates increas- ingly detailed reports about what it is doing. The default level is ze- ro. GENERATED KEYS When dnssec-keygen completes it prints a string of the form Knnnn.+aaa+iiiii on the standard output. This is an identification string for the key it has generated. These strings can be supplied as arguments to dnssec-makekeyset(8). The nnnn. part is the dot-terminated domain name given by name. The DNSSEC algorithm identifier is indicated by aaa - 001 for RSA, 002 for Diffie-Hellman, 003 for DSA or 157 for HMAC-MD5. iiiii is a five-digit number identifying the key. dnssec-keygen creates two files. The file names are adapted from the key identification string above. They have names of the form: Knnnn.+aaa+iiiii.key and Knnnn.+aaa+iiiii.private. These contain the pub- lic and private parts of the key respectively. The files generated by dnssec-keygen obey this naming convention to make it easy for the signing tool dnssec-signzone(8) to identify which file(s) have to be read to find the necessary key(s) for generating or validating signatures. The .key file contains a KEY resource record that can be inserted into a zone file with a $INCLUDE statement. The private part of the key is in the .private file. It contains details of the encryption algorithm that was used and any relevant parameters: prime number, exponent, modulus, subprime, etc. For obvious security reasons, this file does not have general read permission. The private part of the key is used by dnssec- signzone(8) to generate signatures and the public part is used to verify the signatures. Both .key and .private key files are generated for sym- metric encryption algorithm such as HMAC-MD5, even though the public and private key are equivalent. EXAMPLE To generate a 768-bit DSA key for the domain example.com, the following command would be issued: # dnssec-keygen -a DSA -b 768 -n ZONE example.com Kexample.com.+003+26160 dnssec-keygen has printed the key identification string Kexample.com.+003+26160, indicating a DSA key with identifier 26160. It will also have created the files Kexample.com.+003+26160.key and Kexample.com.+003+26160.private containing respectively the public and private keys for the generated DSA key. FILES /dev/random SEE ALSO RFC2535, RFC2845, RFC2539, dnssec-makekeyset(8), dnssec-signkey(8), dnssec-signzone(8). BUGS The naming convention for the public and private key files is a little clumsy. It won't work for domain names that are longer than 236 charac- ters because of the .+aaa+iiiii.private suffix results in filenames that are too long for most UNIX systems. BIND9 Jun 30, 2000 3