openssl-pkey.pod 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. =pod
  2. =head1 NAME
  3. openssl-pkey - public or private key processing tool
  4. =head1 SYNOPSIS
  5. B<openssl> B<pkey>
  6. [B<-help>]
  7. [B<-inform> B<DER>|B<PEM>]
  8. [B<-outform> B<DER>|B<PEM>]
  9. [B<-in> I<filename>]
  10. [B<-passin> I<arg>]
  11. [B<-out> I<filename>]
  12. [B<-passout> I<arg>]
  13. [B<-traditional>]
  14. [B<-I<cipher>>]
  15. [B<-text>]
  16. [B<-text_pub>]
  17. [B<-noout>]
  18. [B<-pubin>]
  19. [B<-pubout>]
  20. [B<-engine> I<id>]
  21. [B<-check>]
  22. [B<-pubcheck>]
  23. =for openssl ifdef engine
  24. =head1 DESCRIPTION
  25. This command processes public or private keys. They can be
  26. converted between various forms and their components printed out.
  27. =head1 OPTIONS
  28. =over 4
  29. =item B<-help>
  30. Print out a usage message.
  31. =item B<-inform> B<DER>|B<PEM>, B<-outform> B<DER>|B<PEM>
  32. The input and formats; the default is B<PEM>.
  33. See L<openssl(1)/Format Options> for details.
  34. =item B<-in> I<filename>
  35. This specifies the input filename to read a key from or standard input if this
  36. option is not specified. If the key is encrypted a pass phrase will be
  37. prompted for.
  38. =item B<-passin> I<arg>, B<-passout> I<arg>
  39. The password source for the input and output file.
  40. For more information about the format of B<arg>
  41. see L<openssl(1)/Pass Phrase Options>.
  42. =item B<-out> I<filename>
  43. This specifies the output filename to write a key to or standard output if this
  44. option is not specified. If any encryption options are set then a pass phrase
  45. will be prompted for. The output filename should B<not> be the same as the input
  46. filename.
  47. =item B<-traditional>
  48. Normally a private key is written using standard format: this is PKCS#8 form
  49. with the appropriate encryption algorithm (if any). If the B<-traditional>
  50. option is specified then the older "traditional" format is used instead.
  51. =item B<-I<cipher>>
  52. These options encrypt the private key with the supplied cipher. Any algorithm
  53. name accepted by EVP_get_cipherbyname() is acceptable such as B<des3>.
  54. =item B<-text>
  55. Prints out the various public or private key components in
  56. plain text in addition to the encoded version.
  57. =item B<-text_pub>
  58. Print out only public key components even if a private key is being processed.
  59. =item B<-noout>
  60. Do not output the encoded version of the key.
  61. =item B<-pubin>
  62. By default a private key is read from the input file: with this
  63. option a public key is read instead.
  64. =item B<-pubout>
  65. By default a private key is output: with this option a public
  66. key will be output instead. This option is automatically set if
  67. the input is a public key.
  68. =item B<-engine> I<id>
  69. Specifying an engine (by its unique I<id> string) will cause this command
  70. to attempt to obtain a functional reference to the specified engine,
  71. thus initialising it if needed. The engine will then be set as the default
  72. for all available algorithms.
  73. =item B<-check>
  74. This option checks the consistency of a key pair for both public and private
  75. components.
  76. =item B<-pubcheck>
  77. This option checks the correctness of either a public key or the public component
  78. of a key pair.
  79. =back
  80. =head1 EXAMPLES
  81. To remove the pass phrase on an RSA private key:
  82. openssl pkey -in key.pem -out keyout.pem
  83. To encrypt a private key using triple DES:
  84. openssl pkey -in key.pem -des3 -out keyout.pem
  85. To convert a private key from PEM to DER format:
  86. openssl pkey -in key.pem -outform DER -out keyout.der
  87. To print out the components of a private key to standard output:
  88. openssl pkey -in key.pem -text -noout
  89. To print out the public components of a private key to standard output:
  90. openssl pkey -in key.pem -text_pub -noout
  91. To just output the public part of a private key:
  92. openssl pkey -in key.pem -pubout -out pubkey.pem
  93. =head1 SEE ALSO
  94. L<openssl(1)>,
  95. L<openssl-genpkey(1)>,
  96. L<openssl-rsa(1)>,
  97. L<openssl-pkcs8(1)>,
  98. L<openssl-dsa(1)>,
  99. L<openssl-genrsa(1)>,
  100. L<openssl-gendsa(1)>
  101. =head1 COPYRIGHT
  102. Copyright 2006-2019 The OpenSSL Project Authors. All Rights Reserved.
  103. Licensed under the Apache License 2.0 (the "License"). You may not use
  104. this file except in compliance with the License. You can obtain a copy
  105. in the file LICENSE in the source distribution or at
  106. L<https://www.openssl.org/source/license.html>.
  107. =cut