PROTOCOL.key 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. This document describes the private key format for OpenSSH.
  2. 1. Overall format
  3. The key consists of a header, a list of public keys, and
  4. an encrypted list of matching private keys.
  5. #define AUTH_MAGIC "openssh-key-v1"
  6. byte[] AUTH_MAGIC
  7. string ciphername
  8. string kdfname
  9. string kdfoptions
  10. int number of keys N
  11. string publickey1
  12. string publickey2
  13. ...
  14. string publickeyN
  15. string encrypted, padded list of private keys
  16. 2. KDF options for kdfname "bcrypt"
  17. The options:
  18. string salt
  19. uint32 rounds
  20. are concatenated and represented as a string.
  21. 3. Unencrypted list of N private keys
  22. The list of privatekey/comment pairs is padded with the
  23. bytes 1, 2, 3, ... until the total length is a multiple
  24. of the cipher block size.
  25. uint32 checkint
  26. uint32 checkint
  27. string privatekey1
  28. string comment1
  29. string privatekey2
  30. string comment2
  31. ...
  32. string privatekeyN
  33. string commentN
  34. char 1
  35. char 2
  36. char 3
  37. ...
  38. char padlen % 255
  39. Before the key is encrypted, a random integer is assigned
  40. to both checkint fields so successful decryption can be
  41. quickly checked by verifying that both checkint fields
  42. hold the same value.
  43. 4. Encryption
  44. The KDF is used to derive a key, IV (and other values required by
  45. the cipher) from the passphrase. These values are then used to
  46. encrypt the unencrypted list of private keys.
  47. 5. No encryption
  48. For unencrypted keys the cipher "none" and the KDF "none"
  49. are used with empty passphrases. The options if the KDF "none"
  50. are the empty string.
  51. $OpenBSD: PROTOCOL.key,v 1.1 2013/12/06 13:34:54 markus Exp $