1PKEY(1) OpenSSL PKEY(1)
2
3
4
6 pkey - public or private key processing tool
7
9 openssl pkey [-inform PEM|DER] [-outform PEM|DER] [-in filename]
10 [-passin arg] [-out filename] [-passout arg] [-cipher] [-text]
11 [-text_pub] [-noout] [-pubin] [-pubout] [-engine id]
12
14 The pkey command processes public or private keys. They can be
15 converted between various forms and their components printed out.
16
18 -inform DER|PEM
19 This specifies the input format DER or PEM.
20
21 -outform DER|PEM
22 This specifies the output format, the options have the same meaning
23 as the -inform option.
24
25 -in filename
26 This specifies the input filename to read a key from or standard
27 input if this option is not specified. If the key is encrypted a
28 pass phrase will be prompted for.
29
30 -passin arg
31 the input file password source. For more information about the
32 format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
33
34 -out filename
35 This specifies the output filename to write a key to or standard
36 output if this option is not specified. If any encryption options
37 are set then a pass phrase will be prompted for. The output
38 filename should not be the same as the input filename.
39
40 -passout password
41 the output file password source. For more information about the
42 format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
43
44 -cipher
45 These options encrypt the private key with the supplied cipher. Any
46 algorithm name accepted by EVP_get_cipherbyname() is acceptable
47 such as des3.
48
49 -text
50 prints out the various public or private key components in plain
51 text in addition to the encoded version.
52
53 -text_pub
54 print out only public key components even if a private key is being
55 processed.
56
57 -noout
58 do not output the encoded version of the key.
59
60 -pubin
61 by default a private key is read from the input file: with this
62 option a public key is read instead.
63
64 -pubout
65 by default a private key is output: with this option a public key
66 will be output instead. This option is automatically set if the
67 input is a public key.
68
69 -engine id
70 specifying an engine (by its unique id string) will cause pkey to
71 attempt to obtain a functional reference to the specified engine,
72 thus initialising it if needed. The engine will then be set as the
73 default for all available algorithms.
74
76 To remove the pass phrase on an RSA private key:
77
78 openssl pkey -in key.pem -out keyout.pem
79
80 To encrypt a private key using triple DES:
81
82 openssl pkey -in key.pem -des3 -out keyout.pem
83
84 To convert a private key from PEM to DER format:
85
86 openssl pkey -in key.pem -outform DER -out keyout.der
87
88 To print out the components of a private key to standard output:
89
90 openssl pkey -in key.pem -text -noout
91
92 To print out the public components of a private key to standard output:
93
94 openssl pkey -in key.pem -text_pub -noout
95
96 To just output the public part of a private key:
97
98 openssl pkey -in key.pem -pubout -out pubkey.pem
99
101 genpkey(1), rsa(1), pkcs8(1), dsa(1), genrsa(1), gendsa(1)
102
103
104
1051.0.1e 2013-02-11 PKEY(1)