openssl-rsa.pod 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. =pod
  2. =head1 NAME
  3. openssl-rsa - RSA key processing tool
  4. =head1 SYNOPSIS
  5. B<openssl> B<rsa>
  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<-aes128>]
  14. [B<-aes192>]
  15. [B<-aes256>]
  16. [B<-aria128>]
  17. [B<-aria192>]
  18. [B<-aria256>]
  19. [B<-camellia128>]
  20. [B<-camellia192>]
  21. [B<-camellia256>]
  22. [B<-des>]
  23. [B<-des3>]
  24. [B<-idea>]
  25. [B<-text>]
  26. [B<-noout>]
  27. [B<-modulus>]
  28. [B<-check>]
  29. [B<-pubin>]
  30. [B<-pubout>]
  31. [B<-RSAPublicKey_in>]
  32. [B<-RSAPublicKey_out>]
  33. [B<-engine> I<id>]
  34. =for openssl ifdef pvk-strong pvk-weak pvk-none engine
  35. =head1 DESCRIPTION
  36. This command processes RSA keys. They can be converted between
  37. various forms and their components printed out. B<Note> this command uses the
  38. traditional SSLeay compatible format for private key encryption: newer
  39. applications should use the more secure PKCS#8 format using the
  40. L<openssl-pkcs8(1)> command.
  41. =head1 OPTIONS
  42. =over 4
  43. =item B<-help>
  44. Print out a usage message.
  45. =item B<-inform> B<DER>|B<PEM>, B<-outform> B<DER>|B<PEM>
  46. The input and formats; the default is B<PEM>.
  47. See L<openssl(1)/Format Options> for details.
  48. =item B<-inform> B<DER>|B<PEM>
  49. The data is a PKCS#1 B<RSAPrivateKey> or B<SubjectPublicKey> object.
  50. On input, PKCS#8 format private keys are also accepted.
  51. =item B<-in> I<filename>
  52. This specifies the input filename to read a key from or standard input if this
  53. option is not specified. If the key is encrypted a pass phrase will be
  54. prompted for.
  55. =item B<-passin> I<arg>, B<-passout> I<arg>
  56. The password source for the input and output file.
  57. For more information about the format of B<arg>
  58. see L<openssl(1)/Pass Phrase Options>.
  59. =item B<-out> I<filename>
  60. This specifies the output filename to write a key to or standard output if this
  61. option is not specified. If any encryption options are set then a pass phrase
  62. will be prompted for. The output filename should B<not> be the same as the input
  63. filename.
  64. =item B<-aes128>, B<-aes192>, B<-aes256>, B<-aria128>, B<-aria192>, B<-aria256>, B<-camellia128>, B<-camellia192>, B<-camellia256>, B<-des>, B<-des3>, B<-idea>
  65. These options encrypt the private key with the specified
  66. cipher before outputting it. A pass phrase is prompted for.
  67. If none of these options is specified the key is written in plain text. This
  68. means that this command can be used to remove the pass phrase from a key
  69. by not giving any encryption option is given, or to add or change the pass
  70. phrase by setting them.
  71. These options can only be used with PEM format output files.
  72. =item B<-text>
  73. Prints out the various public or private key components in
  74. plain text in addition to the encoded version.
  75. =item B<-noout>
  76. This option prevents output of the encoded version of the key.
  77. =item B<-modulus>
  78. This option prints out the value of the modulus of the key.
  79. =item B<-check>
  80. This option checks the consistency of an RSA private key.
  81. =item B<-pubin>
  82. By default a private key is read from the input file: with this
  83. option a public key is read instead.
  84. =item B<-pubout>
  85. By default a private key is output: with this option a public
  86. key will be output instead. This option is automatically set if
  87. the input is a public key.
  88. =item B<-RSAPublicKey_in>, B<-RSAPublicKey_out>
  89. Like B<-pubin> and B<-pubout> except B<RSAPublicKey> format is used instead.
  90. =item B<-engine> I<id>
  91. Specifying an engine (by its unique I<id> string) will cause this command
  92. to attempt to obtain a functional reference to the specified engine,
  93. thus initialising it if needed. The engine will then be set as the default
  94. for all available algorithms.
  95. =back
  96. =head1 EXAMPLES
  97. To remove the pass phrase on an RSA private key:
  98. openssl rsa -in key.pem -out keyout.pem
  99. To encrypt a private key using triple DES:
  100. openssl rsa -in key.pem -des3 -out keyout.pem
  101. To convert a private key from PEM to DER format:
  102. openssl rsa -in key.pem -outform DER -out keyout.der
  103. To print out the components of a private key to standard output:
  104. openssl rsa -in key.pem -text -noout
  105. To just output the public part of a private key:
  106. openssl rsa -in key.pem -pubout -out pubkey.pem
  107. Output the public part of a private key in B<RSAPublicKey> format:
  108. openssl rsa -in key.pem -RSAPublicKey_out -out pubkey.pem
  109. =head1 BUGS
  110. There should be an option that automatically handles F<.key> files,
  111. without having to manually edit them.
  112. =head1 SEE ALSO
  113. L<openssl(1)>,
  114. L<openssl-pkcs8(1)>,
  115. L<openssl-dsa(1)>,
  116. L<openssl-genrsa(1)>,
  117. L<openssl-gendsa(1)>
  118. =head1 COPYRIGHT
  119. Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
  120. Licensed under the Apache License 2.0 (the "License"). You may not use
  121. this file except in compliance with the License. You can obtain a copy
  122. in the file LICENSE in the source distribution or at
  123. L<https://www.openssl.org/source/license.html>.
  124. =cut