![]() |
![]()
| ![]() |
![]()
NAMEdsagen, rsagen, rsafill, asn12dsa, asn12rsa, dsa2pub, rsa2csr, rsa2pub, dsa2ssh, rsa2ssh, rsa2x509 - generate and format dsa and rsa keys SYNOPSISdsagen [ -t tag ] rsagen [ -b nbits ] [ -t tag ] rsafill [ file ] asn12dsa [ -t tag ] [ file ] asn12rsa [ -t tag ] [ file ] dsa2pub [ file ] rsa2pub [ file ] dsa2ssh [ file ] rsa2ssh [ -2 ] [ file ] rsa2x509 [ -e expiretime ] certinfo [ file ] rsa2csr certinfo [ file ] DESCRIPTIONPlan 9 represents DSA and RSA keys as attribute-value pair lists prefixed with the string key; this is the generic key format used by A full DSA private key has the following attributes:
A full RSA private key has the following attributes:
All the numbers in both keys are in hexadecimal except RSA's size , which is decimal. A public key omits the attributes beginning with A key may have other attributes as well (for example, a service attribute identifying how this key is typically used), but to these utilities such attributes are merely comments. For example, a very small (and thus insecure) private key and corresponding public key might be:
Note that the order of the attributes does not matter. Dsagen prints a randomly generated DSA private key using the NIST-recommended algorithm. If tag is specified, it is printed between key and proto=dsa; typically, tag is a sequence of attribute-value comments describing the key. Rsagen prints a randomly generated RSA private key whose n has exactly nbits (default 1024) significant bits. Rsafill reads a private key, recomputes the !kp, !kq, and !c2 attributes if they are missing, and prints a full key. Asn12dsa reads an DSA private key stored as ASN.1 encoded in the binary Distinguished Encoding Rules (DER) and prints a Plan 9 DSA key, inserting tag exactly as dsagen does. ASN.1/DER is a popular key format on Unix and Windows; it is often encoded in text form using the Privacy Enhanced Mail (PEM) format in a section labeled as an ``DSA PRIVATE KEY.'' The command:
extracts the key section from a textual ASN.1/DER/PEM key into binary ASN.1/DER format and then converts it to a Plan 9 DSA key. Asn12rsa is similar but operates on RSA keys. Dsa2pub reads a Plan 9 DSA public or private key, removes the private attributes, and prints the resulting public key. Comment attribtes are preserved. Rsa2pub is similar but operates on RSA keys. Dsa2ssh reads a Plan 9 DSA public or private key and prints the public portion in the format used by SSH version 2 (version 1 did not support DSA). If the key has a comment attribute, that comment is appended to the key. Rsa2ssh is similar but operates on RSA keys. It decides whether to print in version 1 or version 2 format by inspecting the service attribute. Dsa2ssh and rsa2ssh are useful for generating SSH's authorized_keys file. Rsa2x509 reads a Plan 9 RSA private key and writes a self-signed X.509 certificate encoded in ASN.1/DER format to standard output. (Note that ASN.1/DER X.509 certificates are different from ASN.1/DER private keys). The certificate uses the current time as its start time and expires expiretime seconds (default 3 years) later. It contains the public half of the key and includes certinfo as the issuer/subject string (also known as a ``Distinguished Name''). This info is typically in the form:
The X.509 ASN.1/DER format is often encoded in text using a PEM section labeled as a ``CERTIFICATE.'' The command:
generates such a textual certificate. Applications that serve TLS-encrypted sessions typically expect certificates in ASN.1/DER/PEM format. Rsa2csr is like rsa2x509 but writes an X.509 certificate request. EXAMPLESGenerate a fresh key and use it to start the Plan 9 TLS-enabled web server:
Generate a fresh set of SSH keys (only one is necessary), load them into factotum, and configure a remote Unix system to allow those keys for logins:
Convert existing Unix SSH version 2 keys instead of generating new ones:
Load those keys into factotum:
SOURCE/src/cmd/auth SEE ALSOBUGSThere are too many key formats. There is no program to convert SSH version 1 RSA private keys.
|