openssl-pkey.pod.in 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. =pod
  2. =begin comment
  3. {- join("\n", @autowarntext) -}
  4. =end comment
  5. =head1 NAME
  6. openssl-pkey - public or private key processing command
  7. =head1 SYNOPSIS
  8. B<openssl> B<pkey>
  9. [B<-help>]
  10. [B<-inform> B<DER>|B<PEM>|B<P12>|B<ENGINE>]
  11. [B<-outform> B<DER>|B<PEM>]
  12. [B<-in> I<filename>]
  13. [B<-passin> I<arg>]
  14. [B<-out> I<filename>]
  15. [B<-passout> I<arg>]
  16. [B<-traditional>]
  17. [B<-I<cipher>>]
  18. [B<-text>]
  19. [B<-text_pub>]
  20. [B<-noout>]
  21. [B<-pubin>]
  22. [B<-pubout>]
  23. [B<-check>]
  24. [B<-pubcheck>]
  25. [B<-ec_conv_form> I<arg>]
  26. [B<-ec_param_enc> I<arg>]
  27. {- $OpenSSL::safe::opt_engine_synopsis -}
  28. {- $OpenSSL::safe::opt_provider_synopsis -}
  29. =for openssl ifdef engine
  30. =head1 DESCRIPTION
  31. This command processes public or private keys. They can be
  32. converted between various forms and their components printed out.
  33. =head1 OPTIONS
  34. =over 4
  35. =item B<-help>
  36. Print out a usage message.
  37. =item B<-inform> B<DER>|B<PEM>|B<P12>|B<ENGINE>
  38. The key input format; the default is B<PEM>.
  39. The only value with effect is B<ENGINE>; all others have become obsolete.
  40. See L<openssl(1)/Format Options> for details.
  41. =item B<-outform> B<DER>|B<PEM>
  42. The key output formats; the default is B<PEM>.
  43. See L<openssl(1)/Format Options> for details.
  44. =item B<-in> I<filename>
  45. This specifies the input filename to read a key from or standard input if this
  46. option is not specified. If the key is encrypted a pass phrase will be
  47. prompted for.
  48. =item B<-passin> I<arg>, B<-passout> I<arg>
  49. The password source for the input and output file.
  50. For more information about the format of B<arg>
  51. see L<openssl(1)/Pass Phrase Options>.
  52. =item B<-out> I<filename>
  53. This specifies the output filename to write a key to or standard output if this
  54. option is not specified. If any encryption options are set then a pass phrase
  55. will be prompted for. The output filename should B<not> be the same as the input
  56. filename.
  57. =item B<-traditional>
  58. Normally a private key is written using standard format: this is PKCS#8 form
  59. with the appropriate encryption algorithm (if any). If the B<-traditional>
  60. option is specified then the older "traditional" format is used instead.
  61. =item B<-I<cipher>>
  62. These options encrypt the private key with the supplied cipher. Any algorithm
  63. name accepted by EVP_get_cipherbyname() is acceptable such as B<des3>.
  64. =item B<-text>
  65. Prints out the various public or private key components in
  66. plain text in addition to the encoded version.
  67. =item B<-text_pub>
  68. Print out only public key components even if a private key is being processed.
  69. =item B<-noout>
  70. Do not output the encoded version of the key.
  71. =item B<-pubin>
  72. By default a private key is read from the input file: with this
  73. option a public key is read instead.
  74. =item B<-pubout>
  75. By default a private key is output: with this option a public
  76. key will be output instead. This option is automatically set if
  77. the input is a public key.
  78. =item B<-check>
  79. This option checks the consistency of a key pair for both public and private
  80. components.
  81. =item B<-pubcheck>
  82. This option checks the correctness of either a public key or the public component
  83. of a key pair.
  84. =item B<-ec_conv_form> I<arg>
  85. This option only applies to elliptic curve based public and private keys.
  86. This specifies how the points on the elliptic curve are converted
  87. into octet strings. Possible values are: B<compressed> (the default
  88. value), B<uncompressed> and B<hybrid>. For more information regarding
  89. the point conversion forms please read the X9.62 standard.
  90. B<Note> Due to patent issues the B<compressed> option is disabled
  91. by default for binary curves and can be enabled by defining
  92. the preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time.
  93. =item B<-ec_param_enc> I<arg>
  94. This option only applies to elliptic curve based public and private keys.
  95. This specifies how the elliptic curve parameters are encoded.
  96. Possible value are: B<named_curve>, i.e. the ec parameters are
  97. specified by an OID, or B<explicit> where the ec parameters are
  98. explicitly given (see RFC 3279 for the definition of the
  99. EC parameters structures). The default value is B<named_curve>.
  100. B<Note> the B<implicitlyCA> alternative, as specified in RFC 3279,
  101. is currently not implemented in OpenSSL.
  102. {- $OpenSSL::safe::opt_engine_item -}
  103. {- $OpenSSL::safe::opt_provider_item -}
  104. =back
  105. =head1 EXAMPLES
  106. To remove the pass phrase on a private key:
  107. openssl pkey -in key.pem -out keyout.pem
  108. To encrypt a private key using triple DES:
  109. openssl pkey -in key.pem -des3 -out keyout.pem
  110. To convert a private key from PEM to DER format:
  111. openssl pkey -in key.pem -outform DER -out keyout.der
  112. To print out the components of a private key to standard output:
  113. openssl pkey -in key.pem -text -noout
  114. To print out the public components of a private key to standard output:
  115. openssl pkey -in key.pem -text_pub -noout
  116. To just output the public part of a private key:
  117. openssl pkey -in key.pem -pubout -out pubkey.pem
  118. To change the EC parameters encoding to B<explicit>:
  119. openssl pkey -in key.pem -ec_param_enc explicit -out keyout.pem
  120. To change the EC point conversion form to B<compressed>:
  121. openssl pkey -in key.pem -ec_conv_form compressed -out keyout.pem
  122. =head1 SEE ALSO
  123. L<openssl(1)>,
  124. L<openssl-genpkey(1)>,
  125. L<openssl-rsa(1)>,
  126. L<openssl-pkcs8(1)>,
  127. L<openssl-dsa(1)>,
  128. L<openssl-genrsa(1)>,
  129. L<openssl-gendsa(1)>
  130. =head1 HISTORY
  131. The B<-engine> option was deprecated in OpenSSL 3.0.
  132. =head1 COPYRIGHT
  133. Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.
  134. Licensed under the Apache License 2.0 (the "License"). You may not use
  135. this file except in compliance with the License. You can obtain a copy
  136. in the file LICENSE in the source distribution or at
  137. L<https://www.openssl.org/source/license.html>.
  138. =cut