openssl-pkey.pod.in 5.5 KB

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