pkey.pod 4.1 KB

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