2
0

openssl-pkey.pod.in 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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 encoded private and public key is output;
  88. this option restricts the encoded output to the public components.
  89. This option is automatically set if the input is a public key.
  90. =item B<-noout>
  91. Do not output the key in encoded form.
  92. =item B<-text>
  93. Output the various key components in plain text
  94. (possibly in addition to the PEM encoded form).
  95. This cannot be combined with encoded output in DER format.
  96. =item B<-text_pub>
  97. Output in text form only the public key components (also for private keys).
  98. This cannot be combined with encoded output in DER format.
  99. =item B<-ec_conv_form> I<arg>
  100. This option only applies to elliptic-curve based keys.
  101. This specifies how the points on the elliptic curve are converted
  102. into octet strings. Possible values are: B<compressed> (the default
  103. value), B<uncompressed> and B<hybrid>. For more information regarding
  104. the point conversion forms please read the X9.62 standard.
  105. B<Note> Due to patent issues the B<compressed> option is disabled
  106. by default for binary curves and can be enabled by defining
  107. the preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time.
  108. =item B<-ec_param_enc> I<arg>
  109. This option only applies to elliptic curve based public and private keys.
  110. This specifies how the elliptic curve parameters are encoded.
  111. Possible value are: B<named_curve>, i.e. the ec parameters are
  112. specified by an OID, or B<explicit> where the ec parameters are
  113. explicitly given (see RFC 3279 for the definition of the
  114. EC parameters structures). The default value is B<named_curve>.
  115. B<Note> the B<implicitlyCA> alternative, as specified in RFC 3279,
  116. is currently not implemented in OpenSSL.
  117. =back
  118. =head1 EXAMPLES
  119. To remove the pass phrase on a private key:
  120. openssl pkey -in key.pem -out keyout.pem
  121. To encrypt a private key using triple DES:
  122. openssl pkey -in key.pem -des3 -out keyout.pem
  123. To convert a private key from PEM to DER format:
  124. openssl pkey -in key.pem -outform DER -out keyout.der
  125. To print out the components of a private key to standard output:
  126. openssl pkey -in key.pem -text -noout
  127. To print out the public components of a private key to standard output:
  128. openssl pkey -in key.pem -text_pub -noout
  129. To just output the public part of a private key:
  130. openssl pkey -in key.pem -pubout -out pubkey.pem
  131. To change the EC parameters encoding to B<explicit>:
  132. openssl pkey -in key.pem -ec_param_enc explicit -out keyout.pem
  133. To change the EC point conversion form to B<compressed>:
  134. openssl pkey -in key.pem -ec_conv_form compressed -out keyout.pem
  135. =head1 SEE ALSO
  136. L<openssl(1)>,
  137. L<openssl-genpkey(1)>,
  138. L<openssl-rsa(1)>,
  139. L<openssl-pkcs8(1)>,
  140. L<openssl-dsa(1)>,
  141. L<openssl-genrsa(1)>,
  142. L<openssl-gendsa(1)>
  143. =head1 HISTORY
  144. The B<-engine> option was deprecated in OpenSSL 3.0.
  145. =head1 COPYRIGHT
  146. Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
  147. Licensed under the Apache License 2.0 (the "License"). You may not use
  148. this file except in compliance with the License. You can obtain a copy
  149. in the file LICENSE in the source distribution or at
  150. L<https://www.openssl.org/source/license.html>.
  151. =cut