3 rsagen, rsafill, asn12rsa, rsa2asn1, rsa2pub, rsa2ssh, rsa2x509, rsa2csr \- generate and format rsa keys
64 Plan 9 represents an RSA key as an attribute-value pair list
65 prefixed with the string
67 this is the generic key format used by
69 A full RSA private key has the following attributes:
78 the number of significant bits in
82 the encryption exponent
91 the decryption exponent
99 .B "!kp\fR, \fL!kq\fR, \fL!c2
100 parameters derived from the other attributes, cached to speed decryption
103 All the numbers are in hexadecimal except
106 An RSA public key omits the attributes beginning with
108 A key may have other attributes as well (for example, a
110 attribute identifying how this key is typically used),
111 but to these utilities such attributes are merely comments.
113 For example, a very small (and thus insecure) private key and corresponding
117 key proto=rsa size=8 ek=7 n=8F !dk=67 !p=B !q=D !kp=3 !kq=7 !c2=6
118 key proto=rsa size=8 ek=7 n=8F
121 Note that the order of the attributes does not matter.
124 prints a randomly generated RSA private key
133 is specified, it is printed between
139 is a sequence of attribute-value comments describing the key.
148 attributes if they are missing,
149 and prints a full key.
152 reads an RSA private key stored as ASN.1
153 encoded in the binary Distinguished Encoding Rules (DER)
154 and prints a Plan 9 RSA key,
160 ASN.1/DER is a popular key format on Unix and Windows;
161 it is often encoded in text form using the Privacy Enhanced Mail (PEM) format
162 in a section labeled as an
169 auth/pemdecode 'RSA PRIVATE KEY' | auth/asn12rsa
172 extracts the key section from a textual ASN.1/DER/PEM key
173 into binary ASN.1/DER format and then
174 converts it to a Plan 9 RSA key.
177 reads a Plan 9 RSA public or private key,
178 removes the private attributes, and prints the resulting public key.
179 Comment attributes are preserved.
184 but outputs the public key in ASN.1/DER format.
187 reads a Plan 9 RSA public or private key and prints the public portion
188 in the format used by SSH2. The
190 option will set the comment.
193 reads a Plan 9 RSA private key and writes a self-signed X.509 certificate
194 encoded in ASN.1/DER format to standard output.
195 (Note that ASN.1/DER X.509 certificates are different from ASN.1/DER private keys).
196 The certificate uses the current time as its start time and expires
201 It contains the public half of the key
204 as the issuer/subject string (also known as a ``Distinguished Name'').
205 This info is typically in the form:
208 C=US ST=NJ L=07974 O=Lucent OU='Bell Labs' CN=G.R.Emlin
211 One can append further Distinguished Names, DNS Names and
212 E-Mail addresses as a ``Subject Alternative Name'' separated
213 with a comma after the main subject.
215 The X.509 ASN.1/DER format is often encoded in text using a PEM section
217 .RB `` CERTIFICATE .''
221 auth/rsa2x509 'C=US OU=''Bell Labs''' file |
222 auth/pemencode CERTIFICATE
225 generates such a textual certificate.
226 Applications that serve TLS-encrypted sessions (for example,
231 expect certificates in ASN.1/DER/PEM format.
233 The Plan 9 RSA private key needs to be loaded into factotum
234 for TLS server applications. It is recommended to put the key into
236 avoiding it being stored unencrypted on the filesystem.
241 and a RSA private key and outputs a signing request in ASN.1 format.
243 Generate a fresh key and use it to start a TLS-enabled web server:
246 auth/rsagen -t 'service=tls owner=*' >key
247 auth/rsa2x509 'C=US CN=*.cs.bell-labs.com' key |
248 auth/pemencode CERTIFICATE >cert
249 cat key >/mnt/factotum/ctl
250 ip/httpd/httpd -c cert
253 Generate a fresh key and configure a remote Unix system to
254 allow use of that key for logins:
257 auth/rsagen -t 'service=ssh' >key
258 auth/rsa2ssh key | ssh unix 'cat >>.ssh/authorized_keys'
259 cat key >/mnt/factotum/ctl
263 Convert a private key in PEM format (as generated by OpenSSL)
264 and load it into factotum:
267 auth/pemdecode 'PRIVATE KEY' key.pem |
268 auth/asn12rsa -t 'service=tls' >/mnt/factotum/ctl
271 Generate a certificate signing request (CSR) in PEM format:
274 auth/rsa2csr 'CN=example.com' key |
275 auth/pemencode 'CERTIFICATE REQUEST'
283 There are too many key formats.