openssl-pkey.pod.in 6.0 KB

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