1*ebfedea0SLionel Sambuc 2*ebfedea0SLionel Sambuc=pod 3*ebfedea0SLionel Sambuc 4*ebfedea0SLionel Sambuc=head1 NAME 5*ebfedea0SLionel Sambuc 6*ebfedea0SLionel Sambucpkey - public or private key processing tool 7*ebfedea0SLionel Sambuc 8*ebfedea0SLionel Sambuc=head1 SYNOPSIS 9*ebfedea0SLionel Sambuc 10*ebfedea0SLionel SambucB<openssl> B<pkey> 11*ebfedea0SLionel Sambuc[B<-inform PEM|DER>] 12*ebfedea0SLionel Sambuc[B<-outform PEM|DER>] 13*ebfedea0SLionel Sambuc[B<-in filename>] 14*ebfedea0SLionel Sambuc[B<-passin arg>] 15*ebfedea0SLionel Sambuc[B<-out filename>] 16*ebfedea0SLionel Sambuc[B<-passout arg>] 17*ebfedea0SLionel Sambuc[B<-cipher>] 18*ebfedea0SLionel Sambuc[B<-text>] 19*ebfedea0SLionel Sambuc[B<-text_pub>] 20*ebfedea0SLionel Sambuc[B<-noout>] 21*ebfedea0SLionel Sambuc[B<-pubin>] 22*ebfedea0SLionel Sambuc[B<-pubout>] 23*ebfedea0SLionel Sambuc[B<-engine id>] 24*ebfedea0SLionel Sambuc 25*ebfedea0SLionel Sambuc=head1 DESCRIPTION 26*ebfedea0SLionel Sambuc 27*ebfedea0SLionel SambucThe B<pkey> command processes public or private keys. They can be converted 28*ebfedea0SLionel Sambucbetween various forms and their components printed out. 29*ebfedea0SLionel Sambuc 30*ebfedea0SLionel Sambuc=head1 COMMAND OPTIONS 31*ebfedea0SLionel Sambuc 32*ebfedea0SLionel Sambuc=over 4 33*ebfedea0SLionel Sambuc 34*ebfedea0SLionel Sambuc=item B<-inform DER|PEM> 35*ebfedea0SLionel Sambuc 36*ebfedea0SLionel SambucThis specifies the input format DER or PEM. 37*ebfedea0SLionel Sambuc 38*ebfedea0SLionel Sambuc=item B<-outform DER|PEM> 39*ebfedea0SLionel Sambuc 40*ebfedea0SLionel SambucThis specifies the output format, the options have the same meaning as the 41*ebfedea0SLionel SambucB<-inform> option. 42*ebfedea0SLionel Sambuc 43*ebfedea0SLionel Sambuc=item B<-in filename> 44*ebfedea0SLionel Sambuc 45*ebfedea0SLionel SambucThis specifies the input filename to read a key from or standard input if this 46*ebfedea0SLionel Sambucoption is not specified. If the key is encrypted a pass phrase will be 47*ebfedea0SLionel Sambucprompted for. 48*ebfedea0SLionel Sambuc 49*ebfedea0SLionel Sambuc=item B<-passin arg> 50*ebfedea0SLionel Sambuc 51*ebfedea0SLionel Sambucthe input file password source. For more information about the format of B<arg> 52*ebfedea0SLionel Sambucsee the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. 53*ebfedea0SLionel Sambuc 54*ebfedea0SLionel Sambuc=item B<-out filename> 55*ebfedea0SLionel Sambuc 56*ebfedea0SLionel SambucThis specifies the output filename to write a key to or standard output if this 57*ebfedea0SLionel Sambucoption is not specified. If any encryption options are set then a pass phrase 58*ebfedea0SLionel Sambucwill be prompted for. The output filename should B<not> be the same as the input 59*ebfedea0SLionel Sambucfilename. 60*ebfedea0SLionel Sambuc 61*ebfedea0SLionel Sambuc=item B<-passout password> 62*ebfedea0SLionel Sambuc 63*ebfedea0SLionel Sambucthe output file password source. For more information about the format of B<arg> 64*ebfedea0SLionel Sambucsee the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. 65*ebfedea0SLionel Sambuc 66*ebfedea0SLionel Sambuc=item B<-cipher> 67*ebfedea0SLionel Sambuc 68*ebfedea0SLionel SambucThese options encrypt the private key with the supplied cipher. Any algorithm 69*ebfedea0SLionel Sambucname accepted by EVP_get_cipherbyname() is acceptable such as B<des3>. 70*ebfedea0SLionel Sambuc 71*ebfedea0SLionel Sambuc=item B<-text> 72*ebfedea0SLionel Sambuc 73*ebfedea0SLionel Sambucprints out the various public or private key components in 74*ebfedea0SLionel Sambucplain text in addition to the encoded version. 75*ebfedea0SLionel Sambuc 76*ebfedea0SLionel Sambuc=item B<-text_pub> 77*ebfedea0SLionel Sambuc 78*ebfedea0SLionel Sambucprint out only public key components even if a private key is being processed. 79*ebfedea0SLionel Sambuc 80*ebfedea0SLionel Sambuc=item B<-noout> 81*ebfedea0SLionel Sambuc 82*ebfedea0SLionel Sambucdo not output the encoded version of the key. 83*ebfedea0SLionel Sambuc 84*ebfedea0SLionel Sambuc=item B<-pubin> 85*ebfedea0SLionel Sambuc 86*ebfedea0SLionel Sambucby default a private key is read from the input file: with this 87*ebfedea0SLionel Sambucoption a public key is read instead. 88*ebfedea0SLionel Sambuc 89*ebfedea0SLionel Sambuc=item B<-pubout> 90*ebfedea0SLionel Sambuc 91*ebfedea0SLionel Sambucby default a private key is output: with this option a public 92*ebfedea0SLionel Sambuckey will be output instead. This option is automatically set if 93*ebfedea0SLionel Sambucthe input is a public key. 94*ebfedea0SLionel Sambuc 95*ebfedea0SLionel Sambuc=item B<-engine id> 96*ebfedea0SLionel Sambuc 97*ebfedea0SLionel Sambucspecifying an engine (by its unique B<id> string) will cause B<pkey> 98*ebfedea0SLionel Sambucto attempt to obtain a functional reference to the specified engine, 99*ebfedea0SLionel Sambucthus initialising it if needed. The engine will then be set as the default 100*ebfedea0SLionel Sambucfor all available algorithms. 101*ebfedea0SLionel Sambuc 102*ebfedea0SLionel Sambuc=back 103*ebfedea0SLionel Sambuc 104*ebfedea0SLionel Sambuc=head1 EXAMPLES 105*ebfedea0SLionel Sambuc 106*ebfedea0SLionel SambucTo remove the pass phrase on an RSA private key: 107*ebfedea0SLionel Sambuc 108*ebfedea0SLionel Sambuc openssl pkey -in key.pem -out keyout.pem 109*ebfedea0SLionel Sambuc 110*ebfedea0SLionel SambucTo encrypt a private key using triple DES: 111*ebfedea0SLionel Sambuc 112*ebfedea0SLionel Sambuc openssl pkey -in key.pem -des3 -out keyout.pem 113*ebfedea0SLionel Sambuc 114*ebfedea0SLionel SambucTo convert a private key from PEM to DER format: 115*ebfedea0SLionel Sambuc 116*ebfedea0SLionel Sambuc openssl pkey -in key.pem -outform DER -out keyout.der 117*ebfedea0SLionel Sambuc 118*ebfedea0SLionel SambucTo print out the components of a private key to standard output: 119*ebfedea0SLionel Sambuc 120*ebfedea0SLionel Sambuc openssl pkey -in key.pem -text -noout 121*ebfedea0SLionel Sambuc 122*ebfedea0SLionel SambucTo print out the public components of a private key to standard output: 123*ebfedea0SLionel Sambuc 124*ebfedea0SLionel Sambuc openssl pkey -in key.pem -text_pub -noout 125*ebfedea0SLionel Sambuc 126*ebfedea0SLionel SambucTo just output the public part of a private key: 127*ebfedea0SLionel Sambuc 128*ebfedea0SLionel Sambuc openssl pkey -in key.pem -pubout -out pubkey.pem 129*ebfedea0SLionel Sambuc 130*ebfedea0SLionel Sambuc=head1 SEE ALSO 131*ebfedea0SLionel Sambuc 132*ebfedea0SLionel SambucL<genpkey(1)|genpkey(1)>, L<rsa(1)|rsa(1)>, L<pkcs8(1)|pkcs8(1)>, 133*ebfedea0SLionel SambucL<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, L<gendsa(1)|gendsa(1)> 134*ebfedea0SLionel Sambuc 135*ebfedea0SLionel Sambuc=cut 136