1
0

dsa 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. .EQ
  2. delim $$
  3. .EN
  4. .TH DSA 8
  5. .SH NAME
  6. dsagen, asn12dsa, dsa2pub, dsa2ssh \- generate and format dsa keys
  7. .SH SYNOPSIS
  8. .B auth/dsagen
  9. .\" [
  10. .\" .B -b
  11. .\" .I nbits
  12. .\" ]
  13. [
  14. .B -t
  15. .I tag
  16. ]
  17. .PP
  18. .B auth/asn12dsa
  19. [
  20. .B -t
  21. .I tag
  22. ]
  23. [
  24. .I file
  25. ]
  26. .PP
  27. .B auth/dsa2pub
  28. [
  29. .I file
  30. ]
  31. .PP
  32. .B auth/dsa2ssh
  33. [
  34. .B -c
  35. .I comment
  36. ] [
  37. .I file
  38. ]
  39. .SH DESCRIPTION
  40. Plan 9 represents a DSA (Digital Signature Algorithm)
  41. key as an attribute-value pair list
  42. prefixed with the string
  43. .BR key ;
  44. this is the generic key format used by
  45. .IR factotum (4).
  46. A full DSA private key has the following attributes:
  47. .TF secret
  48. .TP
  49. .B proto
  50. must be
  51. .B dsa
  52. .TP
  53. .B !secret
  54. decryption key
  55. .TP
  56. .B p
  57. modulus, a large prime
  58. .TP
  59. .B q
  60. group order, another large prime that divides
  61. .I p
  62. - 1.
  63. .TP
  64. .B alpha
  65. group generator
  66. .TP
  67. .B key
  68. $"alpha" sup secret ~ mod ~ p$
  69. .PD
  70. .LP
  71. All the numbers are in hexadecimal.
  72. A DSA public key omits the attributes beginning with
  73. .LR ! .
  74. A key may have other attributes as well (for example, a
  75. .B service
  76. attribute identifying how this key is typically used),
  77. but to these utilities such attributes are merely comments.
  78. .PP
  79. For example, a private key and corresponding public key might look like this
  80. (with [⋯] indicating elisions and \e marking line breaks for readability):
  81. .IP
  82. .EX
  83. key proto=dsa p=D5[⋯]DB q=C2[⋯]E7 alpha=44[⋯]9B key=C1[⋯]3F \e
  84. !secret=9E[⋯]3B
  85. key proto=dsa p=D5[⋯]DB q=C2[⋯]E7 alpha=44[⋯]9B key=C1[⋯]3F
  86. .EE
  87. .LP
  88. Note that the order of the attributes does not matter.
  89. .PP
  90. .I Dsagen
  91. prints a randomly generated DSA private key
  92. whose
  93. .B n
  94. has exactly
  95. .I nbits
  96. (default 1024)
  97. significant bits.
  98. If
  99. .I tag
  100. is specified, it is printed between
  101. .B key
  102. and
  103. .BR proto=dsa ;
  104. typically,
  105. .I tag
  106. is a sequence of attribute-value comments describing the key.
  107. .PP
  108. .I Asn12dsa
  109. reads an DSA private key stored as ASN.1
  110. encoded in the binary Distinguished Encoding Rules (DER)
  111. and prints a Plan 9 DSA key,
  112. inserting
  113. .I tag
  114. exactly as
  115. .I dsagen
  116. does.
  117. ASN.1/DER is a popular key format on Unix and Windows;
  118. it is often encoded in text form using the Privacy Enhanced Mail (PEM) format
  119. in a section labeled as an
  120. .RB `` DSA
  121. .B PRIVATE
  122. .BR KEY .''
  123. The command:
  124. .IP
  125. .EX
  126. auth/pemdecode 'DSA PRIVATE KEY' | auth/asn12dsa
  127. .EE
  128. .LP
  129. extracts the key section from a textual ASN.1/DER/PEM key
  130. into binary ASN.1/DER format and then
  131. converts it to a Plan 9 DSA key.
  132. .PP
  133. .I Dsa2pub
  134. reads a Plan 9 DSA public or private key,
  135. removes the private attributes, and prints the resulting public key.
  136. Comment attributes are preserved.
  137. .PP
  138. .I Dsa2ssh
  139. reads a Plan 9 DSA public or private key and prints the public portion
  140. in the format used by SSH:
  141. .L ssh-dss
  142. and a long base-64 encoded number.
  143. .EQ
  144. delim @@
  145. .EN
  146. For compatibility with external SSH implementations, the public keys in
  147. .B /sys/lib/ssh/keyring
  148. and
  149. .B $home/lib/keyring
  150. are stored in this format.
  151. .br
  152. .ne 4
  153. .SH EXAMPLES
  154. Generate a fresh key and configure a remote Unix system to
  155. allow use of that key for logins:
  156. .IP
  157. .EX
  158. auth/dsagen -t 'service=ssh' >key
  159. auth/dsa2ssh key | ssh unix 'cat >>.ssh/authorized_keys'
  160. cat key >/mnt/factotum/ctl
  161. ssh unix
  162. .EE
  163. .SH SOURCE
  164. .B /sys/src/cmd/auth
  165. .SH "SEE ALSO
  166. .IR ssh (1),
  167. .IR factotum (4),
  168. .IR pem (8),
  169. .IR rsa (8)
  170. .SH BUGS
  171. There are too many key formats.