2
0

openssl-pkey.pod.in 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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 a public key is read instead.
  62. If the input contains no public key but a private key, its public part is used.
  63. =back
  64. =head2 Output options
  65. =over 4
  66. =item B<-out> I<filename>
  67. This specifies the output filename to save the encoded and/or text output of key
  68. or standard output if this option is not specified.
  69. If any cipher option is set but no B<-passout> is given
  70. then a pass phrase will be prompted for.
  71. The output filename should B<not> be the same as the input filename.
  72. =item B<-outform> B<DER>|B<PEM>
  73. The key output format; the default is B<PEM>.
  74. See L<openssl-format-options(1)> for details.
  75. =item B<-I<cipher>>
  76. Encrypt the PEM encoded private key with the supplied cipher. Any algorithm
  77. name accepted by EVP_get_cipherbyname() is acceptable such as B<aes128>.
  78. Encryption is not supported for DER output.
  79. =item B<-passout> I<arg>
  80. The password source for the output file.
  81. For more information about the format of B<arg>
  82. see L<openssl-passphrase-options(1)>.
  83. =item B<-traditional>
  84. Normally a private key is written using standard format: this is PKCS#8 form
  85. with the appropriate encryption algorithm (if any). If the B<-traditional>
  86. option is specified then the older "traditional" format is used instead.
  87. =item B<-pubout>
  88. By default the private and public key is output;
  89. this option restricts the output to the public components.
  90. This option is automatically set if the input is a public key.
  91. When combined with B<-text>, this is equivalent to B<-text_pub>.
  92. =item B<-noout>
  93. Do not output the key in encoded form.
  94. =item B<-text>
  95. Output the various key components in plain text
  96. (possibly in addition to the PEM encoded form).
  97. This cannot be combined with encoded output in DER format.
  98. =item B<-text_pub>
  99. Output in text form only the public key components (also for private keys).
  100. This cannot be combined with encoded output in DER format.
  101. =item B<-ec_conv_form> I<arg>
  102. This option only applies to elliptic-curve based keys.
  103. This specifies how the points on the elliptic curve are converted
  104. into octet strings. Possible values are: B<compressed> (the default
  105. value), B<uncompressed> and B<hybrid>. For more information regarding
  106. the point conversion forms please read the X9.62 standard.
  107. B<Note> Due to patent issues the B<compressed> option is disabled
  108. by default for binary curves and can be enabled by defining
  109. the preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time.
  110. =item B<-ec_param_enc> I<arg>
  111. This option only applies to elliptic curve based public and private keys.
  112. This specifies how the elliptic curve parameters are encoded.
  113. Possible value are: B<named_curve>, i.e. the ec parameters are
  114. specified by an OID, or B<explicit> where the ec parameters are
  115. explicitly given (see RFC 3279 for the definition of the
  116. EC parameters structures). The default value is B<named_curve>.
  117. B<Note> the B<implicitlyCA> alternative, as specified in RFC 3279,
  118. is currently not implemented in OpenSSL.
  119. =back
  120. =head1 EXAMPLES
  121. To remove the pass phrase on a private key:
  122. openssl pkey -in key.pem -out keyout.pem
  123. To encrypt a private key using triple DES:
  124. openssl pkey -in key.pem -des3 -out keyout.pem
  125. To convert a private key from PEM to DER format:
  126. openssl pkey -in key.pem -outform DER -out keyout.der
  127. To print out the components of a private key to standard output:
  128. openssl pkey -in key.pem -text -noout
  129. To print out the public components of a private key to standard output:
  130. openssl pkey -in key.pem -text_pub -noout
  131. To just output the public part of a private key:
  132. openssl pkey -in key.pem -pubout -out pubkey.pem
  133. To change the EC parameters encoding to B<explicit>:
  134. openssl pkey -in key.pem -ec_param_enc explicit -out keyout.pem
  135. To change the EC point conversion form to B<compressed>:
  136. openssl pkey -in key.pem -ec_conv_form compressed -out keyout.pem
  137. =head1 SEE ALSO
  138. L<openssl(1)>,
  139. L<openssl-genpkey(1)>,
  140. L<openssl-rsa(1)>,
  141. L<openssl-pkcs8(1)>,
  142. L<openssl-dsa(1)>,
  143. L<openssl-genrsa(1)>,
  144. L<openssl-gendsa(1)>
  145. =head1 HISTORY
  146. The B<-engine> option was deprecated in OpenSSL 3.0.
  147. =head1 COPYRIGHT
  148. Copyright 2006-2023 The OpenSSL Project Authors. All Rights Reserved.
  149. Licensed under the Apache License 2.0 (the "License"). You may not use
  150. this file except in compliance with the License. You can obtain a copy
  151. in the file LICENSE in the source distribution or at
  152. L<https://www.openssl.org/source/license.html>.
  153. =cut