diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b667100 --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +*.7z +*.bak +*.deb +*.jar +*.rar +*.run +*.sig +*.tar +*.tar.bz2 +*.tar.gz +*.tar.xz +*.tbz +*.tbz2 +*.tgz +*.txz +*.zip +.*.swp +.editix +.idea/ + +# https://github.com/github/gitignore/blob/master/Go.gitignore +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test +!*test.go + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ diff --git a/README.md b/README.md index 6dfc250..7b72430 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# go_sshkeys +# r00t2.io/sshkeys -OpenSSH key parsing, generation, etc. library for Golang. - -Supports newer "proprietary" key type formatting ("OpenSSH v1"). \ No newline at end of file +OpenSSH key parsing, generation, etc. library for Golang. + +Supports newer "proprietary" key type formatting ("OpenSSH v1"). diff --git a/TODO b/TODO new file mode 100644 index 0000000..7b0ef3f --- /dev/null +++ b/TODO @@ -0,0 +1,8 @@ +- keytypes +-- dsa, ecdsa, ecdsa-sk, ed25519, ed25519-sk, rsa ("-sk" variant is FIDO key) +-- if rsa, signature types: +--- ssh-rsa (sha1), rsa-sha2-256, rsa-sha2-512 (new default) +- ciphers: +-- 3des-cbc, aes128-cbc, aes192-cbc, aes256-cbc, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com, chacha20-poly1305@openssh.com +- kdf +-- bcrypt_pbkdf diff --git a/_ref/encrypted/parse_poc_ed25519.go b/_ref/encrypted/parse_poc_ed25519.go new file mode 100644 index 0000000..83fbd1a --- /dev/null +++ b/_ref/encrypted/parse_poc_ed25519.go @@ -0,0 +1,127 @@ +package main + +import ( + "crypto" + "crypto/aes" + "crypto/cipher" + "crypto/ed25519" + "encoding/hex" + "fmt" + + "github.com/dchest/bcrypt_pbkdf" +) + +/* +Same key as private.ed25519 example. +*/ + +func main() { + const ( + passphrase string = "test" + rounds int = 100 + keySize int = 32 + lenPlain int = 160 + ) + var salt []byte + var bcryptKey []byte + var sk []byte + var pk []byte + var pubkey crypto.PublicKey + var key ed25519.PrivateKey + var decrypted []byte + var aesCtx cipher.Block + var encData []byte + + decrypted = make([]byte, lenPlain) + encData = make([]byte, lenPlain) + + // Import salt + if s, err := hex.DecodeString("50132f72900d68e0a31f9d75b6f0a5bc"); err != nil { + fmt.Println(err) + return + } else { + salt = s + } + + // Import encrypted data + if b, err := hex.DecodeString( + "c49777cd0d1a7d37db77a1814991278f8ce99d572e2c666b93b99867425c60da" + + "4652fddb8555098532b51beeee2959f9db5cf5a0905052720c5de25f2c4dd87e" + + "bcc7bb5ea3d7bcbeacc6b732e4c39295d9991a97ef3f0838f8a9bfd43edb3403" + + "189649088f6cfb78946fb914e358ac6abc64691072f5f2788534d9d42d7f406b" + + "c5090b30df23cb7dd8c5cb938e41facd6e38e8845b8160bff840598118d447c2", + ); err != nil { + fmt.Println(err) + return + } else { + encData = b + } + + // ED25519 keys + // This is used to validate decrypted keys. + if edk, err := hex.DecodeString( + "ce6e2b8d638c9d5219dff455af1a90d0a5b72694cfcedfb93bc1e1b1816dee98" + + "bfa2031aa5463113e40e16896af503c5299ead76b09cb63846f41cc4de1740f6", + ); err != nil { + fmt.Println(err) + return + } else { + key = edk + // .Public() returns a crypto.PublicKey, which... is an interface that seemingly cannot be type asserted to anything. + pubkey = key.Public() + } + sep := len(key) - ed25519.PublicKeySize + pk = key[sep:] + sk = key[0:sep] + + // Bcrypt_pbkdf2 derivation (used for deriving decryption key for AES encrypted private key) + // if k, err := bcrypt_pbkdf.Key([]byte(passphrase), salt, rounds, keySize); err != nil { + if k, err := bcrypt_pbkdf.Key([]byte(passphrase), salt, rounds, keySize+len(salt)); err != nil { + fmt.Println(err) + return + } else { + bcryptKey = k + } + realBcryptKey := bcryptKey[0:sep] + realIV := bcryptKey[sep:] + + // Decrypter + if a, err := aes.NewCipher(realBcryptKey); err != nil { + fmt.Println(err) + return + } else { + aesCtx = a + } + + // Actual cipher setup. AES256-CBC + // d := cipher.NewCBCDecrypter(aesCtx, realIV) + // d.CryptBlocks(decrypted, encData) + + // Actual cipher setup. AES256-CTR + d := cipher.NewCTR(aesCtx, realIV) + d.XORKeyStream(decrypted, encData) + + /* + if p, s, err := ed25519.GenerateKey(nil); err != nil { + fmt.Println(err) + return + } else { + pubkey = p + key = s + pk = key[(len(key) - ed25519.PublicKeySize):] + sk = key[0:(len(key) - ed25519.PublicKeySize)] + } + */ + + fmt.Printf("ED25519 key: %v\n", hex.EncodeToString(key)) + fmt.Printf("Pubkey: %v\n", pubkey) + fmt.Printf("SK: %v\n", hex.EncodeToString(sk)) + fmt.Printf("PK: %v\n", hex.EncodeToString(pk)) + fmt.Printf("Salt: %v\n", hex.EncodeToString(salt)) + fmt.Printf("Bcrypt Key: %v\n", hex.EncodeToString(bcryptKey)) + fmt.Printf("realBcryptKey: %v\n", hex.EncodeToString(realBcryptKey)) + fmt.Printf("realIV: %v\n", hex.EncodeToString(realIV)) + // fmt.Printf("Encrypted data: %v\n", hex.EncodeToString(encData)) + fmt.Printf("Decrypted data?: %v\n", hex.EncodeToString(decrypted)) + +} diff --git a/_ref/encrypted/parse_poc_rsa.go b/_ref/encrypted/parse_poc_rsa.go new file mode 100644 index 0000000..f42f87c --- /dev/null +++ b/_ref/encrypted/parse_poc_rsa.go @@ -0,0 +1,188 @@ +package main + +import ( + "crypto/aes" + "crypto/cipher" + "crypto/rsa" + "encoding/hex" + "fmt" + + "github.com/dchest/bcrypt_pbkdf" +) + +/* +Same key as private.rsa example. +*/ + +func main() { + const ( + passphrase string = "test" + saltLen int = 16 // 3.0.0.0 + rounds int = 100 // 3.0.0.1 + keySize int = 4096 + crtLen int = 256 // 4.0.1.4 + dLen int = 512 // 4.0.1.3 + e int = 65537 // 4.0.0.1 + nLen int = 513 // 4.0.0.2 + pLen int = 257 // 4.0.1.5 + qLen int = 257 // 4.0.1.6 + dataLen int = 1872 // 4.0.1 + ) + var salt []byte + var bcryptKey []byte + var crt []byte + var d []byte + var n []byte + var p []byte + var q []byte + var key rsa.PrivateKey + var decrypted []byte + var aesCtx cipher.Block + var encData []byte + + crt = make([]byte, crtLen) + d = make([]byte, dLen) + n = make([]byte, nLen) + p = make([]byte, pLen) + q = make([]byte, qLen) + decrypted = make([]byte, dataLen) + encData = make([]byte, dataLen) + salt = make([]byte, saltLen) + + // Import salt + if s, err := hex.DecodeString("07d4b07c0b128348916488008d6e130b"); err != nil { + fmt.Println(err) + return + } else { + salt = s + } + + // Import encrypted data + if b, err := hex.DecodeString( + "966e2ce435242fef09787f6e8d93a563092e3f3bc986b44198c81e8049c5c944" + + "419effc0521401dc1ef5bc0e4d6aedeb7d05880bc3f731698b9bceeceae08e5e" + + "05f79f4d22de953c899c3271850e80e804f9b1a79bcec31bba11c08db60f9bd2" + + "206bc3d7bfef74895e4f4e3720649f924544f4a2cea5b9dfb9cc0a2bd8f3ba70" + + "f4ba2e7f42960465c9eade118630f9c832fe84ef548529979d0d6ea079f9d5c4" + + "0e396b098fc509448d26de3cb484b0334afacaba371b52c37c120a5623170c1d" + + "0a39348a151c9fb8aab1049f52cf0c08c77144af314259a90848f3dc62e5831f" + + "ac08720b1c813506f1db1e7940def52dc46c97d6363cda0ff7e2258e2637d2e0" + + "9f26099bbfeac78819198b78374d2424537fe549a2ab3dddaf5f7fdb739c3921" + + "064b04f6ffcfeb5544db533179038e11d0cc622992bc6d0600584d4068a2891d" + + "c748c9c16be32c2a08e96caa2ddec4ddd1a2ab3b018a0b0f166a15ac870a30c8" + + "0cc897dbf15af7e8c2915b3616f237a6646e43c665f7569a5ed1850ad8cd0540" + + "06d389568db55393e780e752ace8f06b70f1e99d86b9445d9c1a7a6476bcbf48" + + "4400a58e5a5a73d2c20d630a9985bbf4c691abb61ee4515aa64a727e7bac4a5e" + + "d7bb5f767c7dcf0035904231283d92445863702a995e792bde1d5ac7dd624898" + + "7b9fe4b0a6f1837ce4fbaa032ff4671a86be8c7e4f9be3718212ead0a6f1b429" + + "88863bf80af17a9814f1ffbed6c81e7f59de5b8c71b9f571fc556cc56aee22be" + + "1b57d48f8ca76a379847c67d0ceb43ead101355e541a57c254ae814f058a0361" + + "92f49d96236c88428e5f54dafefd1a5b8ca12d85cf3833d38d816c6e0e205143" + + "f33e353c471abc978d28d1ac89a724d5aab3e7c48015c5cd3a6f31c258cef131" + + "2574e692c6e495a2a8efbee785a9fe1c727379ea1fdc5b492a83a4aff7b3945a" + + "ef503a95dc52b21474172bb54054b106342f2bde6bc38ad166c1a5c6d88685b8" + + "067f529741b36991352d5df1291b9e3c746a71e2bda796fdddac29d0e2f3fadf" + + "d1f0fd33da75bc6151d3ee27f6199e76c3b9e872fb63b54ad78b0fbe2be84f10" + + "d7e48339c6e63364507074addc5a2bd8c4be5848c291bdb2740d3aa325c35039" + + "6ce28e086eecdd6256f48fb7947b84e85759b1c7e6dd91223e3f828e4253a7ec" + + "6d987ad61bd2179c229a20e8d97e6158cb0be734227698b4695c784c463cac3e" + + "a7d538056d5062a895f8ae64549bd58484a60363ab81bc43e6fde0ee12477051" + + "b53c970f063df2f0ff2fd655b7f81029be545cc841f7321d31304eeba210fdf8" + + "fdad7e1bc8accd4d990c058b30817e85e2c5695ab92c1e129ac7471f338fdd39" + + "4ede16071450c19061e07c135cbe87f01260b36206cbc169c85b9dda26fb3dff" + + "5e7d68fd51a573402dbcc1dc7f49a1cb9c34100b9b3d0bb8b8639c69c7d47490" + + "ab83c8918ad03ae62eee43165e452f854d8d4132186c21f742ee4a3cc614515a" + + "dc7c08940838538503f5c4d5781e984cad93cf7a8d17a68d678b3466afbae362" + + "055d5b6edb0007b59231d3040dbfec8b9782b39c391116f2037e218bfaba46c5" + + "2c56180aeef241d918f214b0b6480b7382875ad9dace4496c3682ea2a697b5fe" + + "43b107d93e1976b2540dbfda2ae223bc1a84d65e0d6702513b8cc442a25fb983" + + "aadfa492d09e3dfd991f9f47470bb73369f634dd50dab26d129c3ba096ad7971" + + "1f0ee4419c1226eb8da42674b2cf77e8f4a3f76ce9e9e249b4d1fcc778ef318d" + + "bd6778556c0f9878ebe6e8324916d78280f23f7e3921b29b42bba6ca2d780399" + + "ca4ed3cb2d036c9bed80b235809198422135e2d842c8f53a4dd59fe0bed889d4" + + "7840164024b1f668cc566978d431eb2a07a20ed06e575551e1b030db1350e94c" + + "929a028a5dc25340e3434f2250e3f49de171bb850875d280050e495544ba71b7" + + "1ea36c2937ad6593e2b5bca28bc38e59cea91f26cd1ca8aa4bd9fbc1c605ae46" + + "ae3f559b3a6ebf89ff569ff365c3cba4b4b91f665ffda397188fe23ea456c802" + + "c47a8062844d404fab41a0fa83fd0dd66e4db51115f026197f4c89a1bf28246b" + + "a9966ca2973b0f3afa43154896a56bfe2153dfaaa3ccd2ab011b7f91470cbdc0" + + "4af7cfe1703de7040f4d7777b068769d4035377cc7664f406b5d69356aa33045" + + "c4334a1e2ce602ea2b1ec666352d14b5996dad451a4cb886c66143dc25f8f1bc" + + "f0ed253febc9733432eada35a6afc982749fa0ec680a881db06171ea37fa8338" + + "1ec90a6afa2f269d9da07c8f302161e26c9a4c21c2560ced811bdf6be402d36a" + + "e2f11f884351241e779a22f8b69a8e3eeaa676e7150143a66b3a92d4dace9f4f" + + "9b61e3f7e0aa7656c818ecfb53303457d51e74e7ec89cf038c9a73f3834383e8" + + "22d2f50c3a7775aa0e63b127a214db7490e488f7ee91782a90de32f4ab22601a" + + "f7b190fcc6a292e42e2f8b69caace994b127e9f91532b6d8c3b7ce08f991d269" + + "220bceeed7d4e6151523e63e41bcd27154fd3a7f7370c04b1258715413ec5f17" + + "f51baa99e8e5cd59ac7af17daecd0e8926002403ab87a422e422a6fb1186b5bb" + + "7db25faffedad247fd741b2461aa3b9612342142af10decefe00c00b37a667ad" + + "7665fbc4085b5312bda690166245a93b", + ); err != nil { + fmt.Println(err) + return + } else { + encData = b + } + + // Bcrypt_pbkdf derivation (used for deriving decryption key for AES encrypted private key) + if k, err := bcrypt_pbkdf.Key([]byte(passphrase), salt, rounds, 32+16); err != nil { + fmt.Println(err) + return + } else { + bcryptKey = k + } + realBcryptKey := bcryptKey[0:32] + realIV := bcryptKey[32:] + + // N + if b, err := hex.DecodeString( + "00b7cec04601ce2a12f0c924cb9a30eb990066812cb14369193f30b2b9fdd4af" + + "cb300c918f2a77d64410f3617ae7c8ca318c257d3c4df4e2c4108bbbe93a8689" + + "4ba14b3575f2f72150bc381dcbfb742c7a196866fd3184ace96761adda0fc299" + + "2f6c866d7569919fc22d9c4bf0de405a8c76d519aa2a5329dc6825777229a5d0" + + "b753a7825a89b95275f9c025e215343c6c88cd6690a221f8ae9ef675ee464dc7" + + "d118da410507ea5d6b6489dd60afd8a6646492db3e279f1a78240db8abbda6c5" + + "0714c9636650a72081e7fa5d472c1428b07eae5d15b64ea1e2a7508512fe9ab6" + + "55f86a313486d3cca1dd8e90acc5c9fba4d6e767507fbab9f3a7f68c748142af" + + "2a3701d31a8a9b7511958aa77187ba702ed934d385afcee42380e95e0e7e9bc0" + + "f4d23367fc770374167b7f0926fb6fdb6d05aad1cfd191824845b014e18153bf" + + "0d1d3c3b1fadbb25a3f1d151f9b684633d8c1690fcd8cad05aac2aeb23dbf19a" + + "37e480a008910319c116d47bd924b39942543b88a0f6127952b2d8e1290f3029" + + "f542aebe9c0c8e36cf3296865cd6643c8924d566ebf4971809399a1ac096fe1e" + + "dc3b5f871bf5ef0b4d44e0ea27620d205142e0bfcf677b4db025532121a3f074" + + "5aa4d0586331733257855a5cecbe3ac4403d04ff0cc0c58b7c04904b402125c2" + + "bc2a63a20ebb309cc6f3e65db301a058b8dace07e71b38f3f3595433f69b198f" + + "07", + ); err != nil { + fmt.Println(err) + return + } else { + n = b + } + + // Decrypter + if a, err := aes.NewCipher(realBcryptKey); err != nil { + fmt.Println(err) + return + } else { + aesCtx = a + } + + // Actual cipher setup. AES256-CTR + decryptor := cipher.NewCTR(aesCtx, realIV) + decryptor.XORKeyStream(decrypted, encData) + + // Print comparisons + fmt.Printf("Salt: %v\n", hex.EncodeToString(salt)) + fmt.Printf("Bcrypt key: %v\n", hex.EncodeToString(bcryptKey)) + fmt.Printf("CRT: %v\n", hex.EncodeToString(crt)) + fmt.Printf("d: %v\n", hex.EncodeToString(d)) + fmt.Printf("n: %v\n", hex.EncodeToString(n)) + fmt.Printf("p: %v\n", hex.EncodeToString(p)) + fmt.Printf("q: %v\n", hex.EncodeToString(q)) + fmt.Printf("key: %v\n", key) + // var aesCtx cipher.Block + fmt.Printf("encData: %v\n", hex.EncodeToString(encData)) + fmt.Printf("Decrypted?: %v\n", hex.EncodeToString(decrypted)) +} diff --git a/_ref/encrypted/private.ed25519 b/_ref/encrypted/private.ed25519 new file mode 100644 index 0000000..52be972 --- /dev/null +++ b/_ref/encrypted/private.ed25519 @@ -0,0 +1,86 @@ +The following uses the aes256-ctr/bcrypt encryption. The passphrase is "test". + +The new "v1" format contains the header "-----BEGIN OPENSSH PRIVATE KEY-----" +and the footer "-----END OPENSSH PRIVATE KEY-----". + +All length ints are uint32, network-byte order. + +PEM: +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABBQEy9ykA +1o4KMfnXW28KW8AAAAZAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIL+iAxqlRjET5A4W +iWr1A8Upnq12sJy2OEb0HMTeF0D2AAAAoMSXd80NGn0323ehgUmRJ4+M6Z1XLixma5O5mG +dCXGDaRlL924VVCYUytRvu7ilZ+dtc9aCQUFJyDF3iXyxN2H68x7teo9e8vqzGtzLkw5KV +2Zkal+8/CDj4qb/UPts0AxiWSQiPbPt4lG+5FONYrGq8ZGkQcvXyeIU02dQtf0BrxQkLMN +8jy33YxcuTjkH6zW446IRbgWC/+EBZgRjUR8I= +-----END OPENSSH PRIVATE KEY----- + +HEX: +00000000: 6f70 656e 7373 682d 6b65 792d 7631 0000 openssh-key-v1.. +00000010: 0000 0a61 6573 3235 362d 6374 7200 0000 ...aes256-ctr... +00000020: 0662 6372 7970 7400 0000 1800 0000 1050 .bcrypt........P +00000030: 132f 7290 0d68 e0a3 1f9d 75b6 f0a5 bc00 ./r..h....u..... +00000040: 0000 6400 0000 0100 0000 3300 0000 0b73 ..d.......3....s +00000050: 7368 2d65 6432 3535 3139 0000 0020 bfa2 sh-ed25519... .. +00000060: 031a a546 3113 e40e 1689 6af5 03c5 299e ...F1.....j...). +00000070: ad76 b09c b638 46f4 1cc4 de17 40f6 0000 .v...8F.....@... +00000080: 00a0 c497 77cd 0d1a 7d37 db77 a181 4991 ....w...}7.w..I. +00000090: 278f 8ce9 9d57 2e2c 666b 93b9 9867 425c '....W.,fk...gB\ +000000a0: 60da 4652 fddb 8555 0985 32b5 1bee ee29 `.FR...U..2....) +000000b0: 59f9 db5c f5a0 9050 5272 0c5d e25f 2c4d Y..\...PRr.]._,M +000000c0: d87e bcc7 bb5e a3d7 bcbe acc6 b732 e4c3 .~...^.......2.. +000000d0: 9295 d999 1a97 ef3f 0838 f8a9 bfd4 3edb .......?.8....>. +000000e0: 3403 1896 4908 8f6c fb78 946f b914 e358 4...I..l.x.o...X +000000f0: ac6a bc64 6910 72f5 f278 8534 d9d4 2d7f .j.di.r..x.4..-. +00000100: 406b c509 0b30 df23 cb7d d8c5 cb93 8e41 @k...0.#.}.....A +00000110: facd 6e38 e884 5b81 60bf f840 5981 18d4 ..n8..[.`..@Y... +00000120: 47c2 G. + +ANNOTATED HEX: +0 6f70656e7373682d6b65792d763100 ("openssh-key-v1" + 0x00) +1.0 0000000a (10) + 1.0.0 6165733235362d637472 ("aes256-ctr") +2.0 00000006 (6) + 2.0.0 626372797074 ("bcrypt") +3.0 00000018 (24) + 3.0.0 - + 3.0.0.0 00000010 (16) + 3.0.0.0.0 50132f72900d68e0a31f9d75b6f0a5bc (bytes) + 3.0.0.1 00000064 (100) +4.0 00000001 (1) + 4.0.0 00000033 (51) + 4.0.0.0 0000000b (11) + 4.0.0.0.0 7373682d65643235353139 ("ssh-ed25519") + 4.0.0.1 00000020 (32) + 4.0.0.1.0 bfa2031aa5463113e40e16896af503c5299ead76b09cb63846f41cc4de1740f6 (bytes) + 4.0.1 000000a0 (160) + 4.0.1.0 - 4.0.1.5 (AES256-CTR encrypted block) (bytes) + c49777cd0d1a7d37db77a1814991278f + 8ce99d572e2c666b93b99867425c60da + 4652fddb8555098532b51beeee2959f9 + db5cf5a0905052720c5de25f2c4dd87e + bcc7bb5ea3d7bcbeacc6b732e4c39295 + d9991a97ef3f0838f8a9bfd43edb3403 + 189649088f6cfb78946fb914e358ac6a + bc64691072f5f2788534d9d42d7f406b + c5090b30df23cb7dd8c5cb938e41facd + 6e38e8845b8160bff840598118d447c2 + +DECRYPTED 4.0.1: +(...) +4.0.1 000000a0 (160) + 4.0.1.0 f890d89a (4170242202) + 4.0.1.1 f890d89a (4170242202) + 4.0.1.2 - + 4.0.1.2.0 0000000b (11) + 4.0.1.2.0.0 7373682d65643235353139 ("ssh-ed25519") + 4.0.1.2.1 00000020 (32) + 4.0.1.2.1.0 (bytes) + bfa2031aa5463113e40e16896af503c5299ead76b09cb63846f41cc4de1740f6 + 4.0.1.3 00000040 (64) + 4.0.1.3.0 (bytes) + ce6e2b8d638c9d5219dff455af1a90d0a5b72694cfcedfb93bc1e1b1816dee98 + bfa2031aa5463113e40e16896af503c5299ead76b09cb63846f41cc4de1740f6 + 4.0.1.4 00000012 (18) + 4.0.1.4.0 5468697320697320612074657374206b6579 ("This is a test key") + 4.0.1.5 0102030405060708090a0b ([1 2 3 4 5 6 7 8 9 10 11], 11 bytes) diff --git a/_ref/encrypted/private.rsa b/_ref/encrypted/private.rsa new file mode 100644 index 0000000..1532348 --- /dev/null +++ b/_ref/encrypted/private.rsa @@ -0,0 +1,334 @@ +The following uses the aes256-ctr/bcrypt encryption. The passphrase is "test". + +The new "v1" format contains the header "-----BEGIN OPENSSH PRIVATE KEY-----" +and the footer "-----END OPENSSH PRIVATE KEY-----". + +All length ints are uint32, network-byte order. + +PEM: +-----BEGIN OPENSSH PRIVATE KEY----- +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 +ZnrXZl+8QIW1MSvaaQFmJFqTs= +-----END OPENSSH PRIVATE KEY----- + +HEX: +00000000: 6f70 656e 7373 682d 6b65 792d 7631 0000 openssh-key-v1.. +00000010: 0000 0a61 6573 3235 362d 6374 7200 0000 ...aes256-ctr... +00000020: 0662 6372 7970 7400 0000 1800 0000 1007 .bcrypt......... +00000030: d4b0 7c0b 1283 4891 6488 008d 6e13 0b00 ..|...H.d...n... +00000040: 0000 6400 0000 0100 0002 1700 0000 0773 ..d............s +00000050: 7368 2d72 7361 0000 0003 0100 0100 0002 sh-rsa.......... +00000060: 0100 b7ce c046 01ce 2a12 f0c9 24cb 9a30 .....F..*...$..0 +00000070: eb99 0066 812c b143 6919 3f30 b2b9 fdd4 ...f.,.Ci.?0.... +00000080: afcb 300c 918f 2a77 d644 10f3 617a e7c8 ..0...*w.D..az.. +00000090: ca31 8c25 7d3c 4df4 e2c4 108b bbe9 3a86 .1.%}'..x$..... +00000120: c507 14c9 6366 50a7 2081 e7fa 5d47 2c14 ....cfP. ...]G,. +00000130: 28b0 7eae 5d15 b64e a1e2 a750 8512 fe9a (.~.]..N...P.... +00000140: b655 f86a 3134 86d3 cca1 dd8e 90ac c5c9 .U.j14.......... +00000150: fba4 d6e7 6750 7fba b9f3 a7f6 8c74 8142 ....gP.......t.B +00000160: af2a 3701 d31a 8a9b 7511 958a a771 87ba .*7.....u....q.. +00000170: 702e d934 d385 afce e423 80e9 5e0e 7e9b p..4.....#..^.~. +00000180: c0f4 d233 67fc 7703 7416 7b7f 0926 fb6f ...3g.w.t.{..&.o +00000190: db6d 05aa d1cf d191 8248 45b0 14e1 8153 .m.......HE....S +000001a0: bf0d 1d3c 3b1f adbb 25a3 f1d1 51f9 b684 ...<;...%...Q... +000001b0: 633d 8c16 90fc d8ca d05a ac2a eb23 dbf1 c=.......Z.*.#.. +000001c0: 9a37 e480 a008 9103 19c1 16d4 7bd9 24b3 .7..........{.$. +000001d0: 9942 543b 88a0 f612 7952 b2d8 e129 0f30 .BT;....yR...).0 +000001e0: 29f5 42ae be9c 0c8e 36cf 3296 865c d664 ).B.....6.2..\.d +000001f0: 3c89 24d5 66eb f497 1809 399a 1ac0 96fe <.$.f.....9..... +00000200: 1edc 3b5f 871b f5ef 0b4d 44e0 ea27 620d ..;_.....MD..'b. +00000210: 2051 42e0 bfcf 677b 4db0 2553 2121 a3f0 QB...g{M.%S!!.. +00000220: 745a a4d0 5863 3173 3257 855a 5cec be3a tZ..Xc1s2W.Z\..: +00000230: c440 3d04 ff0c c0c5 8b7c 0490 4b40 2125 .@=......|..K@!% +00000240: c2bc 2a63 a20e bb30 9cc6 f3e6 5db3 01a0 ..*c...0....]... +00000250: 58b8 dace 07e7 1b38 f3f3 5954 33f6 9b19 X......8..YT3... +00000260: 8f07 0000 0750 966e 2ce4 3524 2fef 0978 .....P.n,.5$/..x +00000270: 7f6e 8d93 a563 092e 3f3b c986 b441 98c8 .n...c..?;...A.. +00000280: 1e80 49c5 c944 419e ffc0 5214 01dc 1ef5 ..I..DA...R..... +00000290: bc0e 4d6a edeb 7d05 880b c3f7 3169 8b9b ..Mj..}.....1i.. +000002a0: ceec eae0 8e5e 05f7 9f4d 22de 953c 899c .....^...M"..<.. +000002b0: 3271 850e 80e8 04f9 b1a7 9bce c31b ba11 2q.............. +000002c0: c08d b60f 9bd2 206b c3d7 bfef 7489 5e4f ...... k....t.^O +000002d0: 4e37 2064 9f92 4544 f4a2 cea5 b9df b9cc N7 d..ED........ +000002e0: 0a2b d8f3 ba70 f4ba 2e7f 4296 0465 c9ea .+...p....B..e.. +000002f0: de11 8630 f9c8 32fe 84ef 5485 2997 9d0d ...0..2...T.)... +00000300: 6ea0 79f9 d5c4 0e39 6b09 8fc5 0944 8d26 n.y....9k....D.& +00000310: de3c b484 b033 4afa caba 371b 52c3 7c12 .<...3J...7.R.|. +00000320: 0a56 2317 0c1d 0a39 348a 151c 9fb8 aab1 .V#....94....... +00000330: 049f 52cf 0c08 c771 44af 3142 59a9 0848 ..R....qD.1BY..H +00000340: f3dc 62e5 831f ac08 720b 1c81 3506 f1db ..b.....r...5... +00000350: 1e79 40de f52d c46c 97d6 363c da0f f7e2 .y@..-.l..6<.... +00000360: 258e 2637 d2e0 9f26 099b bfea c788 1919 %.&7...&........ +00000370: 8b78 374d 2424 537f e549 a2ab 3ddd af5f .x7M$$S..I..=.._ +00000380: 7fdb 739c 3921 064b 04f6 ffcf eb55 44db ..s.9!.K.....UD. +00000390: 5331 7903 8e11 d0cc 6229 92bc 6d06 0058 S1y.....b)..m..X +000003a0: 4d40 68a2 891d c748 c9c1 6be3 2c2a 08e9 M@h....H..k.,*.. +000003b0: 6caa 2dde c4dd d1a2 ab3b 018a 0b0f 166a l.-......;.....j +000003c0: 15ac 870a 30c8 0cc8 97db f15a f7e8 c291 ....0......Z.... +000003d0: 5b36 16f2 37a6 646e 43c6 65f7 569a 5ed1 [6..7.dnC.e.V.^. +000003e0: 850a d8cd 0540 06d3 8956 8db5 5393 e780 .....@...V..S... +000003f0: e752 ace8 f06b 70f1 e99d 86b9 445d 9c1a .R...kp.....D].. +00000400: 7a64 76bc bf48 4400 a58e 5a5a 73d2 c20d zdv..HD...ZZs... +00000410: 630a 9985 bbf4 c691 abb6 1ee4 515a a64a c...........QZ.J +00000420: 727e 7bac 4a5e d7bb 5f76 7c7d cf00 3590 r~{.J^.._v|}..5. +00000430: 4231 283d 9244 5863 702a 995e 792b de1d B1(=.DXcp*.^y+.. +00000440: 5ac7 dd62 4898 7b9f e4b0 a6f1 837c e4fb Z..bH.{......|.. +00000450: aa03 2ff4 671a 86be 8c7e 4f9b e371 8212 ../.g....~O..q.. +00000460: ead0 a6f1 b429 8886 3bf8 0af1 7a98 14f1 .....)..;...z... +00000470: ffbe d6c8 1e7f 59de 5b8c 71b9 f571 fc55 ......Y.[.q..q.U +00000480: 6cc5 6aee 22be 1b57 d48f 8ca7 6a37 9847 l.j."..W....j7.G +00000490: c67d 0ceb 43ea d101 355e 541a 57c2 54ae .}..C...5^T.W.T. +000004a0: 814f 058a 0361 92f4 9d96 236c 8842 8e5f .O...a....#l.B._ +000004b0: 54da fefd 1a5b 8ca1 2d85 cf38 33d3 8d81 T....[..-..83... +000004c0: 6c6e 0e20 5143 f33e 353c 471a bc97 8d28 ln. QC.>5? +000005a0: 828e 4253 a7ec 6d98 7ad6 1bd2 179c 229a ..BS..m.z.....". +000005b0: 20e8 d97e 6158 cb0b e734 2276 98b4 695c ..~aX...4"v..i\ +000005c0: 784c 463c ac3e a7d5 3805 6d50 62a8 95f8 xLF<.>..8.mPb... +000005d0: ae64 549b d584 84a6 0363 ab81 bc43 e6fd .dT......c...C.. +000005e0: e0ee 1247 7051 b53c 970f 063d f2f0 ff2f ...GpQ.<...=.../ +000005f0: d655 b7f8 1029 be54 5cc8 41f7 321d 3130 .U...).T\.A.2.10 +00000600: 4eeb a210 fdf8 fdad 7e1b c8ac cd4d 990c N.......~....M.. +00000610: 058b 3081 7e85 e2c5 695a b92c 1e12 9ac7 ..0.~...iZ.,.... +00000620: 471f 338f dd39 4ede 1607 1450 c190 61e0 G.3..9N....P..a. +00000630: 7c13 5cbe 87f0 1260 b362 06cb c169 c85b |.\....`.b...i.[ +00000640: 9dda 26fb 3dff 5e7d 68fd 51a5 7340 2dbc ..&.=.^}h.Q.s@-. +00000650: c1dc 7f49 a1cb 9c34 100b 9b3d 0bb8 b863 ...I...4...=...c +00000660: 9c69 c7d4 7490 ab83 c891 8ad0 3ae6 2eee .i..t.......:... +00000670: 4316 5e45 2f85 4d8d 4132 186c 21f7 42ee C.^E/.M.A2.l!.B. +00000680: 4a3c c614 515a dc7c 0894 0838 5385 03f5 J<..QZ.|...8S... +00000690: c4d5 781e 984c ad93 cf7a 8d17 a68d 678b ..x..L...z....g. +000006a0: 3466 afba e362 055d 5b6e db00 07b5 9231 4f...b.][n.....1 +000006b0: d304 0dbf ec8b 9782 b39c 3911 16f2 037e ..........9....~ +000006c0: 218b faba 46c5 2c56 180a eef2 41d9 18f2 !...F.,V....A... +000006d0: 14b0 b648 0b73 8287 5ad9 dace 4496 c368 ...H.s..Z...D..h +000006e0: 2ea2 a697 b5fe 43b1 07d9 3e19 76b2 540d ......C...>.v.T. +000006f0: bfda 2ae2 23bc 1a84 d65e 0d67 0251 3b8c ..*.#....^.g.Q;. +00000700: c442 a25f b983 aadf a492 d09e 3dfd 991f .B._........=... +00000710: 9f47 470b b733 69f6 34dd 50da b26d 129c .GG..3i.4.P..m.. +00000720: 3ba0 96ad 7971 1f0e e441 9c12 26eb 8da4 ;...yq...A..&... +00000730: 2674 b2cf 77e8 f4a3 f76c e9e9 e249 b4d1 &t..w....l...I.. +00000740: fcc7 78ef 318d bd67 7855 6c0f 9878 ebe6 ..x.1..gxUl..x.. +00000750: e832 4916 d782 80f2 3f7e 3921 b29b 42bb .2I.....?~9!..B. +00000760: a6ca 2d78 0399 ca4e d3cb 2d03 6c9b ed80 ..-x...N..-.l... +00000770: b235 8091 9842 2135 e2d8 42c8 f53a 4dd5 .5...B!5..B..:M. +00000780: 9fe0 bed8 89d4 7840 1640 24b1 f668 cc56 ......x@.@$..h.V +00000790: 6978 d431 eb2a 07a2 0ed0 6e57 5551 e1b0 ix.1.*....nWUQ.. +000007a0: 30db 1350 e94c 929a 028a 5dc2 5340 e343 0..P.L....].S@.C +000007b0: 4f22 50e3 f49d e171 bb85 0875 d280 050e O"P....q...u.... +000007c0: 4955 44ba 71b7 1ea3 6c29 37ad 6593 e2b5 IUD.q...l)7.e... +000007d0: bca2 8bc3 8e59 cea9 1f26 cd1c a8aa 4bd9 .....Y...&....K. +000007e0: fbc1 c605 ae46 ae3f 559b 3a6e bf89 ff56 .....F.?U.:n...V +000007f0: 9ff3 65c3 cba4 b4b9 1f66 5ffd a397 188f ..e......f_..... +00000800: e23e a456 c802 c47a 8062 844d 404f ab41 .>.V...z.b.M@O.A +00000810: a0fa 83fd 0dd6 6e4d b511 15f0 2619 7f4c ......nM....&..L +00000820: 89a1 bf28 246b a996 6ca2 973b 0f3a fa43 ...($k..l..;.:.C +00000830: 1548 96a5 6bfe 2153 dfaa a3cc d2ab 011b .H..k.!S........ +00000840: 7f91 470c bdc0 4af7 cfe1 703d e704 0f4d ..G...J...p=...M +00000850: 7777 b068 769d 4035 377c c766 4f40 6b5d ww.hv.@57|.fO@k] +00000860: 6935 6aa3 3045 c433 4a1e 2ce6 02ea 2b1e i5j.0E.3J.,...+. +00000870: c666 352d 14b5 996d ad45 1a4c b886 c661 .f5-...m.E.L...a +00000880: 43dc 25f8 f1bc f0ed 253f ebc9 7334 32ea C.%.....%?..s42. +00000890: da35 a6af c982 749f a0ec 680a 881d b061 .5....t...h....a +000008a0: 71ea 37fa 8338 1ec9 0a6a fa2f 269d 9da0 q.7..8...j./&... +000008b0: 7c8f 3021 61e2 6c9a 4c21 c256 0ced 811b |.0!a.l.L!.V.... +000008c0: df6b e402 d36a e2f1 1f88 4351 241e 779a .k...j....CQ$.w. +000008d0: 22f8 b69a 8e3e eaa6 76e7 1501 43a6 6b3a "....>..v...C.k: +000008e0: 92d4 dace 9f4f 9b61 e3f7 e0aa 7656 c818 .....O.a....vV.. +000008f0: ecfb 5330 3457 d51e 74e7 ec89 cf03 8c9a ..S04W..t....... +00000900: 73f3 8343 83e8 22d2 f50c 3a77 75aa 0e63 s..C.."...:wu..c +00000910: b127 a214 db74 90e4 88f7 ee91 782a 90de .'...t......x*.. +00000920: 32f4 ab22 601a f7b1 90fc c6a2 92e4 2e2f 2.."`........../ +00000930: 8b69 caac e994 b127 e9f9 1532 b6d8 c3b7 .i.....'...2.... +00000940: ce08 f991 d269 220b ceee d7d4 e615 1523 .....i"........# +00000950: e63e 41bc d271 54fd 3a7f 7370 c04b 1258 .>A..qT.:.sp.K.X +00000960: 7154 13ec 5f17 f51b aa99 e8e5 cd59 ac7a qT.._........Y.z +00000970: f17d aecd 0e89 2600 2403 ab87 a422 e422 .}....&.$...."." +00000980: a6fb 1186 b5bb 7db2 5faf feda d247 fd74 ......}._....G.t +00000990: 1b24 61aa 3b96 1234 2142 af10 dece fe00 .$a.;..4!B...... +000009a0: c00b 37a6 67ad 7665 fbc4 085b 5312 bda6 ..7.g.ve...[S... +000009b0: 9016 6245 a93b ..bE.; + + +ANNOTATED HEX: +0 6f70656e7373682d6b65792d763100 ("openssh-key-v1" + 0x00) +1.0 0000000a (10) + 1.0.0 6165733235362d637472 ("aes256-ctr") +2.0 00000006 (6) + 2.0.0 626372797074 ("bcrypt") +3.0 00000018 (24) + 3.0.0 - + 3.0.0.0 00000010 (16) + 3.0.0.0.0 07d4b07c0b128348916488008d6e130b (bytes) + 3.0.0.1 00000064 (100) +4.0 00000001 (1) + 4.0.0 00000217 (535) + 4.0.0.0 00000007 (7) + 4.0.0.0.0 7373682d727361 ("ssh-rsa") + 4.0.0.1 00000003 (3) + 4.0.0.1.0 010001 (65537) + 4.0.0.2 00000201 (513) + 4.0.0.2.0 (bytes) + 00b7cec04601ce2a12f0c924cb9a30eb990066812cb14369193f30b2b9fdd4afcb300c918f2a77d64410f3617ae7c8ca318c257d3c4df4e2c4108bbbe93a8689 + 4ba14b3575f2f72150bc381dcbfb742c7a196866fd3184ace96761adda0fc2992f6c866d7569919fc22d9c4bf0de405a8c76d519aa2a5329dc6825777229a5d0 + b753a7825a89b95275f9c025e215343c6c88cd6690a221f8ae9ef675ee464dc7d118da410507ea5d6b6489dd60afd8a6646492db3e279f1a78240db8abbda6c5 + 0714c9636650a72081e7fa5d472c1428b07eae5d15b64ea1e2a7508512fe9ab655f86a313486d3cca1dd8e90acc5c9fba4d6e767507fbab9f3a7f68c748142af + 2a3701d31a8a9b7511958aa77187ba702ed934d385afcee42380e95e0e7e9bc0f4d23367fc770374167b7f0926fb6fdb6d05aad1cfd191824845b014e18153bf + 0d1d3c3b1fadbb25a3f1d151f9b684633d8c1690fcd8cad05aac2aeb23dbf19a37e480a008910319c116d47bd924b39942543b88a0f6127952b2d8e1290f3029 + f542aebe9c0c8e36cf3296865cd6643c8924d566ebf4971809399a1ac096fe1edc3b5f871bf5ef0b4d44e0ea27620d205142e0bfcf677b4db025532121a3f074 + 5aa4d0586331733257855a5cecbe3ac4403d04ff0cc0c58b7c04904b402125c2bc2a63a20ebb309cc6f3e65db301a058b8dace07e71b38f3f3595433f69b198f + 07 + 4.0.1 00000750 (1872) + 4.0.1.0 - 4.0.1.8 (AES256-CTR encrypted block) (bytes) + 966e2ce435242fef09787f6e8d93a563092e3f3bc986b44198c81e8049c5c944419effc0521401dc1ef5bc0e4d6aedeb7d05880bc3f731698b9bceeceae08e5e + 05f79f4d22de953c899c3271850e80e804f9b1a79bcec31bba11c08db60f9bd2206bc3d7bfef74895e4f4e3720649f924544f4a2cea5b9dfb9cc0a2bd8f3ba70 + f4ba2e7f42960465c9eade118630f9c832fe84ef548529979d0d6ea079f9d5c40e396b098fc509448d26de3cb484b0334afacaba371b52c37c120a5623170c1d + 0a39348a151c9fb8aab1049f52cf0c08c77144af314259a90848f3dc62e5831fac08720b1c813506f1db1e7940def52dc46c97d6363cda0ff7e2258e2637d2e0 + 9f26099bbfeac78819198b78374d2424537fe549a2ab3dddaf5f7fdb739c3921064b04f6ffcfeb5544db533179038e11d0cc622992bc6d0600584d4068a2891d + c748c9c16be32c2a08e96caa2ddec4ddd1a2ab3b018a0b0f166a15ac870a30c80cc897dbf15af7e8c2915b3616f237a6646e43c665f7569a5ed1850ad8cd0540 + 06d389568db55393e780e752ace8f06b70f1e99d86b9445d9c1a7a6476bcbf484400a58e5a5a73d2c20d630a9985bbf4c691abb61ee4515aa64a727e7bac4a5e + d7bb5f767c7dcf0035904231283d92445863702a995e792bde1d5ac7dd6248987b9fe4b0a6f1837ce4fbaa032ff4671a86be8c7e4f9be3718212ead0a6f1b429 + 88863bf80af17a9814f1ffbed6c81e7f59de5b8c71b9f571fc556cc56aee22be1b57d48f8ca76a379847c67d0ceb43ead101355e541a57c254ae814f058a0361 + 92f49d96236c88428e5f54dafefd1a5b8ca12d85cf3833d38d816c6e0e205143f33e353c471abc978d28d1ac89a724d5aab3e7c48015c5cd3a6f31c258cef131 + 2574e692c6e495a2a8efbee785a9fe1c727379ea1fdc5b492a83a4aff7b3945aef503a95dc52b21474172bb54054b106342f2bde6bc38ad166c1a5c6d88685b8 + 067f529741b36991352d5df1291b9e3c746a71e2bda796fdddac29d0e2f3fadfd1f0fd33da75bc6151d3ee27f6199e76c3b9e872fb63b54ad78b0fbe2be84f10 + d7e48339c6e63364507074addc5a2bd8c4be5848c291bdb2740d3aa325c350396ce28e086eecdd6256f48fb7947b84e85759b1c7e6dd91223e3f828e4253a7ec + 6d987ad61bd2179c229a20e8d97e6158cb0be734227698b4695c784c463cac3ea7d538056d5062a895f8ae64549bd58484a60363ab81bc43e6fde0ee12477051 + b53c970f063df2f0ff2fd655b7f81029be545cc841f7321d31304eeba210fdf8fdad7e1bc8accd4d990c058b30817e85e2c5695ab92c1e129ac7471f338fdd39 + 4ede16071450c19061e07c135cbe87f01260b36206cbc169c85b9dda26fb3dff5e7d68fd51a573402dbcc1dc7f49a1cb9c34100b9b3d0bb8b8639c69c7d47490 + ab83c8918ad03ae62eee43165e452f854d8d4132186c21f742ee4a3cc614515adc7c08940838538503f5c4d5781e984cad93cf7a8d17a68d678b3466afbae362 + 055d5b6edb0007b59231d3040dbfec8b9782b39c391116f2037e218bfaba46c52c56180aeef241d918f214b0b6480b7382875ad9dace4496c3682ea2a697b5fe + 43b107d93e1976b2540dbfda2ae223bc1a84d65e0d6702513b8cc442a25fb983aadfa492d09e3dfd991f9f47470bb73369f634dd50dab26d129c3ba096ad7971 + 1f0ee4419c1226eb8da42674b2cf77e8f4a3f76ce9e9e249b4d1fcc778ef318dbd6778556c0f9878ebe6e8324916d78280f23f7e3921b29b42bba6ca2d780399 + ca4ed3cb2d036c9bed80b235809198422135e2d842c8f53a4dd59fe0bed889d47840164024b1f668cc566978d431eb2a07a20ed06e575551e1b030db1350e94c + 929a028a5dc25340e3434f2250e3f49de171bb850875d280050e495544ba71b71ea36c2937ad6593e2b5bca28bc38e59cea91f26cd1ca8aa4bd9fbc1c605ae46 + ae3f559b3a6ebf89ff569ff365c3cba4b4b91f665ffda397188fe23ea456c802c47a8062844d404fab41a0fa83fd0dd66e4db51115f026197f4c89a1bf28246b + a9966ca2973b0f3afa43154896a56bfe2153dfaaa3ccd2ab011b7f91470cbdc04af7cfe1703de7040f4d7777b068769d4035377cc7664f406b5d69356aa33045 + c4334a1e2ce602ea2b1ec666352d14b5996dad451a4cb886c66143dc25f8f1bcf0ed253febc9733432eada35a6afc982749fa0ec680a881db06171ea37fa8338 + 1ec90a6afa2f269d9da07c8f302161e26c9a4c21c2560ced811bdf6be402d36ae2f11f884351241e779a22f8b69a8e3eeaa676e7150143a66b3a92d4dace9f4f + 9b61e3f7e0aa7656c818ecfb53303457d51e74e7ec89cf038c9a73f3834383e822d2f50c3a7775aa0e63b127a214db7490e488f7ee91782a90de32f4ab22601a + f7b190fcc6a292e42e2f8b69caace994b127e9f91532b6d8c3b7ce08f991d269220bceeed7d4e6151523e63e41bcd27154fd3a7f7370c04b1258715413ec5f17 + f51baa99e8e5cd59ac7af17daecd0e8926002403ab87a422e422a6fb1186b5bb7db25faffedad247fd741b2461aa3b9612342142af10decefe00c00b37a667ad + 7665fbc4085b5312bda690166245a93b + + +DECRYPTED 4.0.1: +(...) +4.0.1 00000750 (1872) + 4.0.1.0 0d98bd61 (228113761) + 4.0.1.1 0d98bd61 (228113761) + 4.0.1.2 - + 4.0.1.2.0 00000007 (7) + 4.0.1.2.0.0 7373682d727361 ("ssh-rsa") + 4.0.1.2.1 00000201 (513) + 4.0.1.2.1.0 (bytes) + 00b7cec04601ce2a12f0c924cb9a30eb990066812cb14369193f30b2b9fdd4afcb300c918f2a77d64410f3617ae7c8ca318c257d3c4df4e2c4108bbbe93a8689 + 4ba14b3575f2f72150bc381dcbfb742c7a196866fd3184ace96761adda0fc2992f6c866d7569919fc22d9c4bf0de405a8c76d519aa2a5329dc6825777229a5d0 + b753a7825a89b95275f9c025e215343c6c88cd6690a221f8ae9ef675ee464dc7d118da410507ea5d6b6489dd60afd8a6646492db3e279f1a78240db8abbda6c5 + 0714c9636650a72081e7fa5d472c1428b07eae5d15b64ea1e2a7508512fe9ab655f86a313486d3cca1dd8e90acc5c9fba4d6e767507fbab9f3a7f68c748142af + 2a3701d31a8a9b7511958aa77187ba702ed934d385afcee42380e95e0e7e9bc0f4d23367fc770374167b7f0926fb6fdb6d05aad1cfd191824845b014e18153bf + 0d1d3c3b1fadbb25a3f1d151f9b684633d8c1690fcd8cad05aac2aeb23dbf19a37e480a008910319c116d47bd924b39942543b88a0f6127952b2d8e1290f3029 + f542aebe9c0c8e36cf3296865cd6643c8924d566ebf4971809399a1ac096fe1edc3b5f871bf5ef0b4d44e0ea27620d205142e0bfcf677b4db025532121a3f074 + 5aa4d0586331733257855a5cecbe3ac4403d04ff0cc0c58b7c04904b402125c2bc2a63a20ebb309cc6f3e65db301a058b8dace07e71b38f3f3595433f69b198f + 07 + 4.0.1.2.2 00000003 (3) + 4.0.1.2.2.0 010001 (65537) + 4.0.1.3 00000200 (512) + 4.0.1.3.0 (bytes) + 499f2c705e04bfe17a4476d27e5e1ddfd8c335f63ac22f748754f02183440f6da93f3f86429261663e0bddfda69d4c2f705d0bbe7dd31a8941bf5672e29844a1 + e0670970c6f2a98b76f85b26fafedb59c49786b8df7eaeeb86171fd579fe8df0eadd2536a4244a0332d5a9ad3eb8340c930464153e82b4ffad4f647a7ba808e3 + 854450f806b60e0b670fc99cb6b58786497d4c199e7750ee5089934eef25f46512394955c487e10744ebdb9a00951c8095b024d4ce75f1da3146b5b3447169f5 + 9e23d40685438bc7bcad1173927a389a0903ba111a46809d123b3432197cca8fc0c27816fbf215c2b7c584b94f37c9ed8a8e815942effdcf54757268afe58fd7 + 00cdcf6a98a20950617b0624aa835d95e27d7afcdee70c397ca1b6aa04735e6d5c5e01bfff2174cf562d36842624490e12ca8142595d52567494f38b2124012c + acacb2564e21c845eb94f5d6ebf6f39066e1fa04b318174e6f9994823ba4d9ef2c28b37cb3ea05fa3cad7200898394276835523e4e416054f23db0eb732211d3 + a11ea551390ae8d58d69e14664e0e20f2bf0ccd24d260b832a94144f5801ea7cdbb2436f21ba2dbaecbcd573f24c5e0d43fd26b4ae6764e138ddaf4775ac0163 + e45727c10027f716cbe3cc70fff73441bb2538e5426a1a5638b448a7bde968041ec2184ef67b0da60070297cd73deeefebd1951611c7a776c956e18e5f163a21 + 4.0.1.4 00000100 (256) + 4.0.1.4.0 (bytes) + 0ae2e1cf2455a0d82272e6a42bbba83eb765496e5a33e13b8c94756d8c32f7d7505fd997bdd5ec08c59bf8d1d659d1df02bec669ebb5aaaf5db1ec70ce2f2a6b + 3a17b7b1fce3adc6203c2905cd652d7622065dd011ae33894467c6dca3643952b0caedff9bc78ac40408074027566ee4c4751ad3ff452a2781af8b5c2c9bf09b + 34ee5e6201330b4bc381af766798667c5b9ad0733c19f4ef475fd264655e030553f2f2f8de59c2aee74b9dd6720e3108143dfedd41cf4bc11de2b9a9f40faec7 + 2a52312abee4c6155acfee9384a16348c715346ebe693895fe6d2348d4dedb0a137c487185ff949c209115b9c8a106329991f049e8430c7ba60dd5408d72ac98 + 4.0.1.5 00000101 (257) + 4.0.1.5.0 (bytes) + 00e50b65ba6ae4cb29ae66129c3e41ffeba36cd6ecbaa7045ff90cea71d09bc056b0b9134dc5754c49da1fe8ab169cd149eedaeccf4913d915f4f241c5fd86c7 + 7511e0c261c344600a84cce78e8cf493e492844cb82c42ab6d1246a53e5cf50ad4759c2a5c09d53b1c5c3b449328eea01434d6e537b3a513928dfaddf0a72728 + 23899b8d795220cb3344ab8d0e846e1e40ffdfb5c719262c2b527a890a51faabcf10904699135f7b997487f4b48d4490ad80fc25b346fa0bb587f09295bf0f71 + ac10a8086867d4bad00a0c27a6456f08e0c2bf8caed8768f0366a2440428180a292617af61feabab9a7075b8bc21209a5439bbfe3613917071fee74a8d5d80fe + 99 + 4.0.1.6 00000101 (257) + 4.0.1.6.0 (bytes) + 00cd7077659fad983104bcc7dc526242b9ea52cea40e923df771ac2a28e377f2b9231a58c2448c6b8d17fe83571ef6bdbbc11f3d4ab4254ea859684b8772911f + 9c6f355479053e3e3d3a6ecce13a016908298ca3f8b628d2111749a3627628eb05844f546795a5067d39b1d304e19cc6fc1be00a6164ea33e4abbc87f5683227 + 1d825c868c5ccda3775b037711e99436f96c53f3780b985084e1d84a458c687ab0938a09bf6f9b3ffec41ed02fd5b27572c7d180039e405a559b62fc08f804b1 + 9f043dba4c6f7565b1c72759f4b932d4f93d4f41da91b1b146f29854a1008341e4760bdd4987097ec4a6551ab96e099a04a38d6a893b533db185abb55736419e + 9f + 4.0.1.7 00000018 (24) + 4.0.1.7.0 54686973206973206120636f6d6d656e7420737472696e67 ("This is a comment string") + 4.0.1.8 010203 ([1 2 3], 3 bytes) diff --git a/_ref/encrypted/public.ed25519 b/_ref/encrypted/public.ed25519 new file mode 100644 index 0000000..b12cdeb --- /dev/null +++ b/_ref/encrypted/public.ed25519 @@ -0,0 +1,16 @@ +The following uses the bcrypt encryption. The passphrase is "test". + +PEM: +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+iAxqlRjET5A4WiWr1A8Upnq12sJy2OEb0HMTeF0D2 This is a test key + +HEX: +00000000: 0000 000b 7373 682d 6564 3235 3531 3900 ....ssh-ed25519. +00000010: 0000 20bf a203 1aa5 4631 13e4 0e16 896a .. .....F1.....j +00000020: f503 c529 9ead 76b0 9cb6 3846 f41c c4de ...)..v...8F.... +00000030: 1740 f6 .@. + +ANNOTATED HEX: +0 0000000b (11) + 0.0 7373682d65643235353139 ("ssh-ed25519") +1 00000020 (32) + 1.1 bfa2031aa5463113e40e16896af503c5299ead76b09cb63846f41cc4de1740f6 (bytes) diff --git a/_ref/encrypted/public.rsa b/_ref/encrypted/public.rsa new file mode 100644 index 0000000..ef695e0 --- /dev/null +++ b/_ref/encrypted/public.rsa @@ -0,0 +1,66 @@ +The following uses the bcrypt encryption (4096-bit). The passphrase is "test". + +PEM: +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3zsBGAc4qEvDJJMuaMOuZAGaBLLFDaRk/MLK5/dSvyzAMkY8qd9ZEEPNheufIyjGMJX08TfTixBCLu+k6holLoUs1dfL3IVC8OB3L+3QsehloZv0xhKzpZ2Gt2g/CmS9shm11aZGfwi2cS/DeQFqMdtUZqipTKdxoJXdyKaXQt1OnglqJuVJ1+cAl4hU0PGyIzWaQoiH4rp72de5GTcfRGNpBBQfqXWtkid1gr9imZGSS2z4nnxp4JA24q72mxQcUyWNmUKcggef6XUcsFCiwfq5dFbZOoeKnUIUS/pq2VfhqMTSG08yh3Y6QrMXJ+6TW52dQf7q586f2jHSBQq8qNwHTGoqbdRGViqdxh7pwLtk004WvzuQjgOleDn6bwPTSM2f8dwN0Fnt/CSb7b9ttBarRz9GRgkhFsBThgVO/DR08Ox+tuyWj8dFR+baEYz2MFpD82MrQWqwq6yPb8Zo35ICgCJEDGcEW1HvZJLOZQlQ7iKD2EnlSstjhKQ8wKfVCrr6cDI42zzKWhlzWZDyJJNVm6/SXGAk5mhrAlv4e3Dtfhxv17wtNRODqJ2INIFFC4L/PZ3tNsCVTISGj8HRapNBYYzFzMleFWlzsvjrEQD0E/wzAxYt8BJBLQCElwrwqY6IOuzCcxvPmXbMBoFi42s4H5xs48/NZVDP2mxmPBw== This is a comment string + +HEX: +00000000: 0000 0007 7373 682d 7273 6100 0000 0301 ....ssh-rsa..... +00000010: 0001 0000 0201 00b7 cec0 4601 ce2a 12f0 ..........F..*.. +00000020: c924 cb9a 30eb 9900 6681 2cb1 4369 193f .$..0...f.,.Ci.? +00000030: 30b2 b9fd d4af cb30 0c91 8f2a 77d6 4410 0......0...*w.D. +00000040: f361 7ae7 c8ca 318c 257d 3c4d f4e2 c410 .az...1.%}'..x$ +000000d0: 0db8 abbd a6c5 0714 c963 6650 a720 81e7 .........cfP. .. +000000e0: fa5d 472c 1428 b07e ae5d 15b6 4ea1 e2a7 .]G,.(.~.]..N... +000000f0: 5085 12fe 9ab6 55f8 6a31 3486 d3cc a1dd P.....U.j14..... +00000100: 8e90 acc5 c9fb a4d6 e767 507f bab9 f3a7 .........gP..... +00000110: f68c 7481 42af 2a37 01d3 1a8a 9b75 1195 ..t.B.*7.....u.. +00000120: 8aa7 7187 ba70 2ed9 34d3 85af cee4 2380 ..q..p..4.....#. +00000130: e95e 0e7e 9bc0 f4d2 3367 fc77 0374 167b .^.~....3g.w.t.{ +00000140: 7f09 26fb 6fdb 6d05 aad1 cfd1 9182 4845 ..&.o.m.......HE +00000150: b014 e181 53bf 0d1d 3c3b 1fad bb25 a3f1 ....S...<;...%.. +00000160: d151 f9b6 8463 3d8c 1690 fcd8 cad0 5aac .Q...c=.......Z. +00000170: 2aeb 23db f19a 37e4 80a0 0891 0319 c116 *.#...7......... +00000180: d47b d924 b399 4254 3b88 a0f6 1279 52b2 .{.$..BT;....yR. +00000190: d8e1 290f 3029 f542 aebe 9c0c 8e36 cf32 ..).0).B.....6.2 +000001a0: 9686 5cd6 643c 8924 d566 ebf4 9718 0939 ..\.d<.$.f.....9 +000001b0: 9a1a c096 fe1e dc3b 5f87 1bf5 ef0b 4d44 .......;_.....MD +000001c0: e0ea 2762 0d20 5142 e0bf cf67 7b4d b025 ..'b. QB...g{M.% +000001d0: 5321 21a3 f074 5aa4 d058 6331 7332 5785 S!!..tZ..Xc1s2W. +000001e0: 5a5c ecbe 3ac4 403d 04ff 0cc0 c58b 7c04 Z\..:.@=......|. +000001f0: 904b 4021 25c2 bc2a 63a2 0ebb 309c c6f3 .K@!%..*c...0... +00000200: e65d b301 a058 b8da ce07 e71b 38f3 f359 .]...X......8..Y +00000210: 5433 f69b 198f 07 T3..... + + +ANNOTATED HEX: +0 00000007 (7) + 0.0 7373682d727361 ("ssh-rsa") +1 00000003 (3) + 1.0 010001 (65537) +2 00000201 (513) + 2.0 (bytes) + 00b7cec04601ce2a12f0c924cb9a30eb990066812cb14369193f30b2b9fdd4af + cb300c918f2a77d64410f3617ae7c8ca318c257d3c4df4e2c4108bbbe93a8689 + 4ba14b3575f2f72150bc381dcbfb742c7a196866fd3184ace96761adda0fc299 + 2f6c866d7569919fc22d9c4bf0de405a8c76d519aa2a5329dc6825777229a5d0 + b753a7825a89b95275f9c025e215343c6c88cd6690a221f8ae9ef675ee464dc7 + d118da410507ea5d6b6489dd60afd8a6646492db3e279f1a78240db8abbda6c5 + 0714c9636650a72081e7fa5d472c1428b07eae5d15b64ea1e2a7508512fe9ab6 + 55f86a313486d3cca1dd8e90acc5c9fba4d6e767507fbab9f3a7f68c748142af + 2a3701d31a8a9b7511958aa77187ba702ed934d385afcee42380e95e0e7e9bc0 + f4d23367fc770374167b7f0926fb6fdb6d05aad1cfd191824845b014e18153bf + 0d1d3c3b1fadbb25a3f1d151f9b684633d8c1690fcd8cad05aac2aeb23dbf19a + 37e480a008910319c116d47bd924b39942543b88a0f6127952b2d8e1290f3029 + f542aebe9c0c8e36cf3296865cd6643c8924d566ebf4971809399a1ac096fe1e + dc3b5f871bf5ef0b4d44e0ea27620d205142e0bfcf677b4db025532121a3f074 + 5aa4d0586331733257855a5cecbe3ac4403d04ff0cc0c58b7c04904b402125c2 + bc2a63a20ebb309cc6f3e65db301a058b8dace07e71b38f3f3595433f69b198f + 07 diff --git a/_ref/format.ed25519 b/_ref/format.ed25519 new file mode 100644 index 0000000..d849f1a --- /dev/null +++ b/_ref/format.ed25519 @@ -0,0 +1,45 @@ +ANNOTATED HEX REFERENCE: + +PRIVATE: +0 "openssh-key-v1" string plus terminating nullbyte +1.0 uint32 allocator for 1.0.0 + 1.0.0 cipher name (string) - if not encrypted (no passphrase), "none" +2.0 uint32 allocator for 2.0.0 + 2.0.0 KDF name (string) - if not encrypted (no passphrase), "none" +3.0 uint32 allocator for 3.0.0 (nullbyte if unencrypted key) + 3.0.0 (virtual) KDF options. This is "missing" if it is an unencrypted key. + 3.0.0.0 uint32 allocator for 3.0.0.0.0 + 3.0.0.0.0 Salt/IV (bytes) + 3.0.0.1 Number of rounds/"work factor" (uint32) +4.0 uint32 allocator for # of keys (currently unused; hardcoded to 1 (left zero-padded 0x01)) + 4.0.0 uint32 allocator for public key #1 (4.0.0.0 to 4.0.0.1, inclusive) + 4.0.0.0 uint32 allocator for 4.0.0.0.0 + 4.0.0.0.0 public key #1 keytype (string) + 4.0.0.1 uint32 allocator for 4.0.0.1.0 + 4.0.0.1.0 public key #1 payload (bytes) + 4.0.1 uint32 allocator for private key #1 (4.0.1.0 to 4.0.1.5, inclusive?)[0] + 4.0.1.0 Checksum (random uint32) #1 (should match 4.0.1.1) + 4.0.1.1 Checksum (random uint32) #2 (should match 4.0.1.0) + 4.0.1.2 (virtual) Copy of public key (copy of 4.0.0.0 to 4.0.0.1, inclusive) + 4.0.1.2.0 uint32 allocator for 4.0.1.2.0.0 + 4.0.1.2.0.0 public key #1 keytype (string) + 4.0.1.2.1 uint32 allocator for 4.0.1.2.1.0 + 4.0.1.2.1.0 public key #1 payload (bytes) + 4.0.1.3 uint32 allocator for 4.0.1.3.0 + 4.0.1.3.0 Private key #1 (bytes) + 4.0.1.4 uint32 allocator for 4.0.1.4.0 + 4.0.1.4.0 Comment for key #1 (string) + 4.0.1.5 Sequential padding to align private key to cipher blocksize (8 for unencrypted keys)[1]. + + +[0] If it is an encrypted key, everything below 4.0.1 is encrypted per 1.0.0, 2.0.0, and 3.0.0. +[1] Pad determined by: 8 - ((4.0.1.3 + 4.0.1.4) % 8) (??) + + + +PUBLIC: +(Each .pub file's Base64 string contains 4.0.0.0 to 4.0.0.1 inclusive above) +0 uint32 allocator for 0.0 + 0.0 Public key keytype (string) +1 uint32 allocator for 1.0 + 1.0 Public key payload (bytes) diff --git a/_ref/format.rsa b/_ref/format.rsa new file mode 100644 index 0000000..0022ec0 --- /dev/null +++ b/_ref/format.rsa @@ -0,0 +1,57 @@ +ANNOTATED HEX REFERENCE: + +PRIVATE: +0 "openssh-key-v1" string plus terminating nullbyte +1.0 uint32 allocator for 1.0.0 + 1.0.0 cipher name (string) - if not encrypted (no passphrase), "none" +2.0 uint32 allocator for 2.0.0 + 2.0.0 KDF name (string) - if not encrypted (no passphrase), "none" +3.0 uint32 allocator for 3.0.0 (nullbyte if unencrypted key) + 3.0.0 (virtual) KDF options. This is "missing" if it is an unencrypted key. + 3.0.0.0 uint32 allocator for 3.0.0.0.0 + 3.0.0.0.0 Salt/IV (bytes) + 3.0.0.1 Number of rounds/"work factor" (uint32) +4.0 uint32 allocator for # of keys (currently unused; hardcoded to 1 (left zero-padded 0x01)) + 4.0.0 uint32 allocator for public key #1 (4.0.0.0 to 4.0.0.1, inclusive) + 4.0.0.0 uint32 allocator for 4.0.0.0.0 + 4.0.0.0.0 public key #1 keytype (string) + 4.0.0.1 uint32 allocator for 4.0.0.1.0 + 4.0.0.1.0 public exponent ("e") + 4.0.0.2 uint32 allocator for 4.0.0.2.0 + 4.0.0.2.0 modulus ("n") + 4.0.1 uint32 allocator for private key #1 (4.0.1.0 to 4.0.1.5, inclusive?)[0] + 4.0.1.0 Checksum (random uint32) #1 (should match 4.0.1.1) + 4.0.1.1 Checksum (random uint32) #2 (should match 4.0.1.0) + 4.0.1.2 (virtual) Copy of public key (with flipped e/n) (copy of 4.0.0.0 to 4.0.0.1, inclusive) + 4.0.1.2.0 uint32 allocator for 4.0.1.2.0.0 + 4.0.1.2.0.0 public key #1 keytype (string) + 4.0.1.2.1 uint32 allocator for 4.0.1.2.1.0 + 4.0.1.2.1.0 modulus ("n") + 4.0.1.2.2 uint32 allocator for 4.0.1.2.2.0 + 4.0.1.2.2.0 public exponent ("e") + 4.0.1.3 uint32 allocator for 4.0.1.3.0 + 4.0.1.3.0 private exponent ("d") + 4.0.1.4 uint32 allocator for 4.0.1.4.0 + 4.0.1.4.0 CRT helper value ("q^(-1) mod p") + 4.0.1.5 uint32 allocator for 4.0.1.5.0 + 4.0.1.5.0 prime #1 ("p") + 4.0.1.6 uint32 allocator for 4.0.1.6.0 + 4.0.1.6.0 prime #2 ("q") + 4.0.1.7 uint32 allocator for 4.0.1.7.0 + 4.0.1.7.0 Comment for key #1 (string) + 4.0.1.8 Sequential padding to align private key to cipher blocksize (8 for unencrypted keys?)[1]. + + +[0] If it is an encrypted key, everything below 4.0.1 is encrypted per 1.0.0, 2.0.0, and 3.0.0. +[1] Pad determined by ?? + + + +PUBLIC: +(Each .pub file's Base64 string contains 4.0.0.0 to 4.0.0.2 inclusive above) +0 uint32 allocator for 0.0 + 0.0 public key #1 keytype (string) +1 uint32 allocator for 1.0 + 1.0 public exponent ("e") +2 uint32 allocator for 2.0 + 2.0 modulus ("n") diff --git a/_ref/plain/private.ed25519 b/_ref/plain/private.ed25519 new file mode 100644 index 0000000..c3092a0 --- /dev/null +++ b/_ref/plain/private.ed25519 @@ -0,0 +1,62 @@ +The following is a plaintext key (no passphrase provided). + +The new "v1" format contains the header "-----BEGIN OPENSSH PRIVATE KEY-----" +and the footer "-----END OPENSSH PRIVATE KEY-----". + +All length ints are uint32, network-byte order. + +PEM: +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACBEOIvJc2hN1mhXExEiv/ISyYO7prFixOl80R9zw52XsAAAAJjPbUqwz21K +sAAAAAtzc2gtZWQyNTUxOQAAACBEOIvJc2hN1mhXExEiv/ISyYO7prFixOl80R9zw52XsA +AAAEBqSF+KwoLTOqI6+TnpcaZY4ckcamLrBF8CvtJbNZflJ0Q4i8lzaE3WaFcTESK/8hLJ +g7umsWLE6XzRH3PDnZewAAAAElRoaXMgaXMgYSB0ZXN0IGtleQECAw== +-----END OPENSSH PRIVATE KEY----- + +HEX (only base64 string above): +00000000: 6f70 656e 7373 682d 6b65 792d 7631 0000 openssh-key-v1.. +00000010: 0000 046e 6f6e 6500 0000 046e 6f6e 6500 ...none....none. +00000020: 0000 0000 0000 0100 0000 3300 0000 0b73 ..........3....s +00000030: 7368 2d65 6432 3535 3139 0000 0020 4438 sh-ed25519... D8 +00000040: 8bc9 7368 4dd6 6857 1311 22bf f212 c983 ..shM.hW.."..... +00000050: bba6 b162 c4e9 7cd1 1f73 c39d 97b0 0000 ...b..|..s...... +00000060: 0098 cf6d 4ab0 cf6d 4ab0 0000 000b 7373 ...mJ..mJ.....ss +00000070: 682d 6564 3235 3531 3900 0000 2044 388b h-ed25519... D8. +00000080: c973 684d d668 5713 1122 bff2 12c9 83bb .shM.hW.."...... +00000090: a6b1 62c4 e97c d11f 73c3 9d97 b000 0000 ..b..|..s....... +000000a0: 406a 485f 8ac2 82d3 3aa2 3af9 39e9 71a6 @jH_....:.:.9.q. +000000b0: 58e1 c91c 6a62 eb04 5f02 bed2 5b35 97e5 X...jb.._...[5.. +000000c0: 2744 388b c973 684d d668 5713 1122 bff2 'D8..shM.hW..".. +000000d0: 12c9 83bb a6b1 62c4 e97c d11f 73c3 9d97 ......b..|..s... +000000e0: b000 0000 1254 6869 7320 6973 2061 2074 .....This is a t +000000f0: 6573 7420 6b65 7901 0203 est key... + +ANNOTATED HEX: +0 6f70656e7373682d6b65792d763100 ("openssh-key-v1" + 0x00) +1.0 00000004 (4) + 1.0.0 6e6f6e65 ("none") +2.0 00000004 (4) + 2.0.0 6e6f6e65 ("none") +3.0 00000000 (0x00) + 3.0.0 (N/A) +4.0 00000001 (1) + 4.0.0 00000033 (51) + 4.0.0.0 0000000b (11) + 4.0.0.0.0 7373682d65643235353139 ("ssh-ed25519") + 4.0.0.1 00000020 (32) + 4.0.0.1.0 44388bc973684dd66857131122bff212c983bba6b162c4e97cd11f73c39d97b0 (bytes) + 4.0.1 00000098 (151) + 4.0.1.0 cf6d4ab0 (3480046256) + 4.0.1.1 cf6d4ab0 (3480046256) + 4.0.1.2 - + 4.0.1.2.0 0000000b (11) + 4.0.1.2.0.0 7373682d65643235353139 ("ssh-ed25519") + 4.0.1.2.1 00000020 (32) + 4.0.1.2.1.0 44388bc973684dd66857131122bff212c983bba6b162c4e97cd11f73c39d97b0 (bytes) + 4.0.1.3 00000040 (64) + 4.0.1.3.0 6a485f8ac282d33aa23af939e971a658e1c91c6a62eb045f02bed25b3597e527 + 44388bc973684dd66857131122bff212c983bba6b162c4e97cd11f73c39d97b0 (bytes) + 4.0.1.4 00000012 (18) + 4.0.1.4.0 5468697320697320612074657374206b6579 ("This is a test key") + 4.0.1.5 010203 ([1 2 3], 3 bytes) diff --git a/_ref/plain/private.rsa b/_ref/plain/private.rsa new file mode 100644 index 0000000..67248d1 --- /dev/null +++ b/_ref/plain/private.rsa @@ -0,0 +1,328 @@ +The following is a plaintext key (no passphrase provided). + +The new "v1" format contains the header "-----BEGIN OPENSSH PRIVATE KEY-----" +and the footer "-----END OPENSSH PRIVATE KEY-----". + +All length ints are uint32, network-byte order. + +PEM: +-----BEGIN OPENSSH PRIVATE KEY----- +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 +-----END OPENSSH PRIVATE KEY----- + +HEX (only base64 string above): +00000000: 6f70 656e 7373 682d 6b65 792d 7631 0000 openssh-key-v1.. +00000010: 0000 046e 6f6e 6500 0000 046e 6f6e 6500 ...none....none. +00000020: 0000 0000 0000 0100 0002 1700 0000 0773 ...............s +00000030: 7368 2d72 7361 0000 0003 0100 0100 0002 sh-rsa.......... +00000040: 0100 b7ce c046 01ce 2a12 f0c9 24cb 9a30 .....F..*...$..0 +00000050: eb99 0066 812c b143 6919 3f30 b2b9 fdd4 ...f.,.Ci.?0.... +00000060: afcb 300c 918f 2a77 d644 10f3 617a e7c8 ..0...*w.D..az.. +00000070: ca31 8c25 7d3c 4df4 e2c4 108b bbe9 3a86 .1.%}'..x$..... +00000100: c507 14c9 6366 50a7 2081 e7fa 5d47 2c14 ....cfP. ...]G,. +00000110: 28b0 7eae 5d15 b64e a1e2 a750 8512 fe9a (.~.]..N...P.... +00000120: b655 f86a 3134 86d3 cca1 dd8e 90ac c5c9 .U.j14.......... +00000130: fba4 d6e7 6750 7fba b9f3 a7f6 8c74 8142 ....gP.......t.B +00000140: af2a 3701 d31a 8a9b 7511 958a a771 87ba .*7.....u....q.. +00000150: 702e d934 d385 afce e423 80e9 5e0e 7e9b p..4.....#..^.~. +00000160: c0f4 d233 67fc 7703 7416 7b7f 0926 fb6f ...3g.w.t.{..&.o +00000170: db6d 05aa d1cf d191 8248 45b0 14e1 8153 .m.......HE....S +00000180: bf0d 1d3c 3b1f adbb 25a3 f1d1 51f9 b684 ...<;...%...Q... +00000190: 633d 8c16 90fc d8ca d05a ac2a eb23 dbf1 c=.......Z.*.#.. +000001a0: 9a37 e480 a008 9103 19c1 16d4 7bd9 24b3 .7..........{.$. +000001b0: 9942 543b 88a0 f612 7952 b2d8 e129 0f30 .BT;....yR...).0 +000001c0: 29f5 42ae be9c 0c8e 36cf 3296 865c d664 ).B.....6.2..\.d +000001d0: 3c89 24d5 66eb f497 1809 399a 1ac0 96fe <.$.f.....9..... +000001e0: 1edc 3b5f 871b f5ef 0b4d 44e0 ea27 620d ..;_.....MD..'b. +000001f0: 2051 42e0 bfcf 677b 4db0 2553 2121 a3f0 QB...g{M.%S!!.. +00000200: 745a a4d0 5863 3173 3257 855a 5cec be3a tZ..Xc1s2W.Z\..: +00000210: c440 3d04 ff0c c0c5 8b7c 0490 4b40 2125 .@=......|..K@!% +00000220: c2bc 2a63 a20e bb30 9cc6 f3e6 5db3 01a0 ..*c...0....]... +00000230: 58b8 dace 07e7 1b38 f3f3 5954 33f6 9b19 X......8..YT3... +00000240: 8f07 0000 0750 5383 4712 5383 4712 0000 .....PS.G.S.G... +00000250: 0007 7373 682d 7273 6100 0002 0100 b7ce ..ssh-rsa....... +00000260: c046 01ce 2a12 f0c9 24cb 9a30 eb99 0066 .F..*...$..0...f +00000270: 812c b143 6919 3f30 b2b9 fdd4 afcb 300c .,.Ci.?0......0. +00000280: 918f 2a77 d644 10f3 617a e7c8 ca31 8c25 ..*w.D..az...1.% +00000290: 7d3c 4df4 e2c4 108b bbe9 3a86 894b a14b }'..x$......... +00000320: 6366 50a7 2081 e7fa 5d47 2c14 28b0 7eae cfP. ...]G,.(.~. +00000330: 5d15 b64e a1e2 a750 8512 fe9a b655 f86a ]..N...P.....U.j +00000340: 3134 86d3 cca1 dd8e 90ac c5c9 fba4 d6e7 14.............. +00000350: 6750 7fba b9f3 a7f6 8c74 8142 af2a 3701 gP.......t.B.*7. +00000360: d31a 8a9b 7511 958a a771 87ba 702e d934 ....u....q..p..4 +00000370: d385 afce e423 80e9 5e0e 7e9b c0f4 d233 .....#..^.~....3 +00000380: 67fc 7703 7416 7b7f 0926 fb6f db6d 05aa g.w.t.{..&.o.m.. +00000390: d1cf d191 8248 45b0 14e1 8153 bf0d 1d3c .....HE....S...< +000003a0: 3b1f adbb 25a3 f1d1 51f9 b684 633d 8c16 ;...%...Q...c=.. +000003b0: 90fc d8ca d05a ac2a eb23 dbf1 9a37 e480 .....Z.*.#...7.. +000003c0: a008 9103 19c1 16d4 7bd9 24b3 9942 543b ........{.$..BT; +000003d0: 88a0 f612 7952 b2d8 e129 0f30 29f5 42ae ....yR...).0).B. +000003e0: be9c 0c8e 36cf 3296 865c d664 3c89 24d5 ....6.2..\.d<.$. +000003f0: 66eb f497 1809 399a 1ac0 96fe 1edc 3b5f f.....9.......;_ +00000400: 871b f5ef 0b4d 44e0 ea27 620d 2051 42e0 .....MD..'b. QB. +00000410: bfcf 677b 4db0 2553 2121 a3f0 745a a4d0 ..g{M.%S!!..tZ.. +00000420: 5863 3173 3257 855a 5cec be3a c440 3d04 Xc1s2W.Z\..:.@=. +00000430: ff0c c0c5 8b7c 0490 4b40 2125 c2bc 2a63 .....|..K@!%..*c +00000440: a20e bb30 9cc6 f3e6 5db3 01a0 58b8 dace ...0....]...X... +00000450: 07e7 1b38 f3f3 5954 33f6 9b19 8f07 0000 ...8..YT3....... +00000460: 0003 0100 0100 0002 0049 9f2c 705e 04bf .........I.,p^.. +00000470: e17a 4476 d27e 5e1d dfd8 c335 f63a c22f .zDv.~^....5.:./ +00000480: 7487 54f0 2183 440f 6da9 3f3f 8642 9261 t.T.!.D.m.??.B.a +00000490: 663e 0bdd fda6 9d4c 2f70 5d0b be7d d31a f>.....L/p]..}.. +000004a0: 8941 bf56 72e2 9844 a1e0 6709 70c6 f2a9 .A.Vr..D..g.p... +000004b0: 8b76 f85b 26fa fedb 59c4 9786 b8df 7eae .v.[&...Y.....~. +000004c0: eb86 171f d579 fe8d f0ea dd25 36a4 244a .....y.....%6.$J +000004d0: 0332 d5a9 ad3e b834 0c93 0464 153e 82b4 .2...>.4...d.>.. +000004e0: ffad 4f64 7a7b a808 e385 4450 f806 b60e ..Odz{....DP.... +000004f0: 0b67 0fc9 9cb6 b587 8649 7d4c 199e 7750 .g.......I}L..wP +00000500: ee50 8993 4eef 25f4 6512 3949 55c4 87e1 .P..N.%.e.9IU... +00000510: 0744 ebdb 9a00 951c 8095 b024 d4ce 75f1 .D.........$..u. +00000520: da31 46b5 b344 7169 f59e 23d4 0685 438b .1F..Dqi..#...C. +00000530: c7bc ad11 7392 7a38 9a09 03ba 111a 4680 ....s.z8......F. +00000540: 9d12 3b34 3219 7cca 8fc0 c278 16fb f215 ..;42.|....x.... +00000550: c2b7 c584 b94f 37c9 ed8a 8e81 5942 effd .....O7.....YB.. +00000560: cf54 7572 68af e58f d700 cdcf 6a98 a209 .Turh.......j... +00000570: 5061 7b06 24aa 835d 95e2 7d7a fcde e70c Pa{.$..]..}z.... +00000580: 397c a1b6 aa04 735e 6d5c 5e01 bfff 2174 9|....s^m\^...!t +00000590: cf56 2d36 8426 2449 0e12 ca81 4259 5d52 .V-6.&$I....BY]R +000005a0: 5674 94f3 8b21 2401 2cac acb2 564e 21c8 Vt...!$.,...VN!. +000005b0: 45eb 94f5 d6eb f6f3 9066 e1fa 04b3 1817 E........f...... +000005c0: 4e6f 9994 823b a4d9 ef2c 28b3 7cb3 ea05 No...;...,(.|... +000005d0: fa3c ad72 0089 8394 2768 3552 3e4e 4160 .<.r....'h5R>NA` +000005e0: 54f2 3db0 eb73 2211 d3a1 1ea5 5139 0ae8 T.=..s".....Q9.. +000005f0: d58d 69e1 4664 e0e2 0f2b f0cc d24d 260b ..i.Fd...+...M&. +00000600: 832a 9414 4f58 01ea 7cdb b243 6f21 ba2d .*..OX..|..Co!.- +00000610: baec bcd5 73f2 4c5e 0d43 fd26 b4ae 6764 ....s.L^.C.&..gd +00000620: e138 ddaf 4775 ac01 63e4 5727 c100 27f7 .8..Gu..c.W'..'. +00000630: 16cb e3cc 70ff f734 41bb 2538 e542 6a1a ....p..4A.%8.Bj. +00000640: 5638 b448 a7bd e968 041e c218 4ef6 7b0d V8.H...h....N.{. +00000650: a600 7029 7cd7 3dee efeb d195 1611 c7a7 ..p)|.=......... +00000660: 76c9 56e1 8e5f 163a 2100 0001 000a e2e1 v.V.._.:!....... +00000670: cf24 55a0 d822 72e6 a42b bba8 3eb7 6549 .$U.."r..+..>.eI +00000680: 6e5a 33e1 3b8c 9475 6d8c 32f7 d750 5fd9 nZ3.;..um.2..P_. +00000690: 97bd d5ec 08c5 9bf8 d1d6 59d1 df02 bec6 ..........Y..... +000006a0: 69eb b5aa af5d b1ec 70ce 2f2a 6b3a 17b7 i....]..p./*k:.. +000006b0: b1fc e3ad c620 3c29 05cd 652d 7622 065d ..... <)..e-v".] +000006c0: d011 ae33 8944 67c6 dca3 6439 52b0 caed ...3.Dg...d9R... +000006d0: ff9b c78a c404 0807 4027 566e e4c4 751a ........@'Vn..u. +000006e0: d3ff 452a 2781 af8b 5c2c 9bf0 9b34 ee5e ..E*'...\,...4.^ +000006f0: 6201 330b 4bc3 81af 7667 9866 7c5b 9ad0 b.3.K...vg.f|[.. +00000700: 733c 19f4 ef47 5fd2 6465 5e03 0553 f2f2 s<...G_.de^..S.. +00000710: f8de 59c2 aee7 4b9d d672 0e31 0814 3dfe ..Y...K..r.1..=. +00000720: dd41 cf4b c11d e2b9 a9f4 0fae c72a 5231 .A.K.........*R1 +00000730: 2abe e4c6 155a cfee 9384 a163 48c7 1534 *....Z.....cH..4 +00000740: 6ebe 6938 95fe 6d23 48d4 dedb 0a13 7c48 n.i8..m#H.....|H +00000750: 7185 ff94 9c20 9115 b9c8 a106 3299 91f0 q.... ......2... +00000760: 49e8 430c 7ba6 0dd5 408d 72ac 9800 0001 I.C.{...@.r..... +00000770: 0100 e50b 65ba 6ae4 cb29 ae66 129c 3e41 ....e.j..).f..>A +00000780: ffeb a36c d6ec baa7 045f f90c ea71 d09b ...l....._...q.. +00000790: c056 b0b9 134d c575 4c49 da1f e8ab 169c .V...M.uLI...... +000007a0: d149 eeda eccf 4913 d915 f4f2 41c5 fd86 .I....I.....A... +000007b0: c775 11e0 c261 c344 600a 84cc e78e 8cf4 .u...a.D`....... +000007c0: 93e4 9284 4cb8 2c42 ab6d 1246 a53e 5cf5 ....L.,B.m.F.>\. +000007d0: 0ad4 759c 2a5c 09d5 3b1c 5c3b 4493 28ee ..u.*\..;.\;D.(. +000007e0: a014 34d6 e537 b3a5 1392 8dfa ddf0 a727 ..4..7.........' +000007f0: 2823 899b 8d79 5220 cb33 44ab 8d0e 846e (#...yR .3D....n +00000800: 1e40 ffdf b5c7 1926 2c2b 527a 890a 51fa .@.....&,+Rz..Q. +00000810: abcf 1090 4699 135f 7b99 7487 f4b4 8d44 ....F.._{.t....D +00000820: 90ad 80fc 25b3 46fa 0bb5 87f0 9295 bf0f ....%.F......... +00000830: 71ac 10a8 0868 67d4 bad0 0a0c 27a6 456f q....hg.....'.Eo +00000840: 08e0 c2bf 8cae d876 8f03 66a2 4404 2818 .......v..f.D.(. +00000850: 0a29 2617 af61 feab ab9a 7075 b8bc 2120 .)&..a....pu..! +00000860: 9a54 39bb fe36 1391 7071 fee7 4a8d 5d80 .T9..6..pq..J.]. +00000870: fe99 0000 0101 00cd 7077 659f ad98 3104 ........pwe...1. +00000880: bcc7 dc52 6242 b9ea 52ce a40e 923d f771 ...RbB..R....=.q +00000890: ac2a 28e3 77f2 b923 1a58 c244 8c6b 8d17 .*(.w..#.X.D.k.. +000008a0: fe83 571e f6bd bbc1 1f3d 4ab4 254e a859 ..W......=J.%N.Y +000008b0: 684b 8772 911f 9c6f 3554 7905 3e3e 3d3a hK.r...o5Ty.>>=: +000008c0: 6ecc e13a 0169 0829 8ca3 f8b6 28d2 1117 n..:.i.)....(... +000008d0: 49a3 6276 28eb 0584 4f54 6795 a506 7d39 I.bv(...OTg...}9 +000008e0: b1d3 04e1 9cc6 fc1b e00a 6164 ea33 e4ab ..........ad.3.. +000008f0: bc87 f568 3227 1d82 5c86 8c5c cda3 775b ...h2'..\..\..w[ +00000900: 0377 11e9 9436 f96c 53f3 780b 9850 84e1 .w...6.lS.x..P.. +00000910: d84a 458c 687a b093 8a09 bf6f 9b3f fec4 .JE.hz.....o.?.. +00000920: 1ed0 2fd5 b275 72c7 d180 039e 405a 559b ../..ur.....@ZU. +00000930: 62fc 08f8 04b1 9f04 3dba 4c6f 7565 b1c7 b.......=.Loue.. +00000940: 2759 f4b9 32d4 f93d 4f41 da91 b1b1 46f2 'Y..2..=OA....F. +00000950: 9854 a100 8341 e476 0bdd 4987 097e c4a6 .T...A.v..I..~.. +00000960: 551a b96e 099a 04a3 8d6a 893b 533d b185 U..n.....j.;S=.. +00000970: abb5 5736 419e 9f00 0000 1854 6869 7320 ..W6A......This +00000980: 6973 2061 2063 6f6d 6d65 6e74 2073 7472 is a comment str +00000990: 696e 6701 0203 ing... + + +ANNOTATED HEX: +0 6f70656e7373682d6b65792d763100 ("openssh-key-v1" + 0x00) +1.0 00000004 (4) + 1.0.0 6e6f6e65 ("none") +2.0 00000004 (4) + 2.0.0 6e6f6e65 ("none") +3.0 00000000 (0x00) + 3.0.0 (N/A) +4.0 00000001 (1) + 4.0.0 00000217 (535) + 4.0.0.0 00000007 (7) + 4.0.0.0.0 7373682d727361 ("ssh-rsa") + 4.0.0.1 00000003 (3) + 4.0.0.1.0 010001 (65537) + 4.0.0.2 00000201 (513) + 4.0.0.2.0 (bytes) + 00b7cec04601ce2a12f0c924cb9a30eb990066812cb14369193f30b2b9fdd4af + cb300c918f2a77d64410f3617ae7c8ca318c257d3c4df4e2c4108bbbe93a8689 + 4ba14b3575f2f72150bc381dcbfb742c7a196866fd3184ace96761adda0fc299 + 2f6c866d7569919fc22d9c4bf0de405a8c76d519aa2a5329dc6825777229a5d0 + b753a7825a89b95275f9c025e215343c6c88cd6690a221f8ae9ef675ee464dc7 + d118da410507ea5d6b6489dd60afd8a6646492db3e279f1a78240db8abbda6c5 + 0714c9636650a72081e7fa5d472c1428b07eae5d15b64ea1e2a7508512fe9ab6 + 55f86a313486d3cca1dd8e90acc5c9fba4d6e767507fbab9f3a7f68c748142af + 2a3701d31a8a9b7511958aa77187ba702ed934d385afcee42380e95e0e7e9bc0 + f4d23367fc770374167b7f0926fb6fdb6d05aad1cfd191824845b014e18153bf + 0d1d3c3b1fadbb25a3f1d151f9b684633d8c1690fcd8cad05aac2aeb23dbf19a + 37e480a008910319c116d47bd924b39942543b88a0f6127952b2d8e1290f3029 + f542aebe9c0c8e36cf3296865cd6643c8924d566ebf4971809399a1ac096fe1e + dc3b5f871bf5ef0b4d44e0ea27620d205142e0bfcf677b4db025532121a3f074 + 5aa4d0586331733257855a5cecbe3ac4403d04ff0cc0c58b7c04904b402125c2 + bc2a63a20ebb309cc6f3e65db301a058b8dace07e71b38f3f3595433f69b198f + 07 + 4.0.1 00000750 (1872) + 4.0.1.0 53834712 (1401112338) + 4.0.1.1 53834712 (1401112338) + 4.0.1.2 - + 4.0.1.2.0 00000007 (7) + 4.0.1.2.0.0 7373682d727361 ("ssh-rsa") + 4.0.1.2.1 00000201 (513) + 4.0.1.2.1.0 (bytes) + 00b7cec04601ce2a12f0c924cb9a30eb990066812cb14369193f30b2b9fdd4af + cb300c918f2a77d64410f3617ae7c8ca318c257d3c4df4e2c4108bbbe93a8689 + 4ba14b3575f2f72150bc381dcbfb742c7a196866fd3184ace96761adda0fc299 + 2f6c866d7569919fc22d9c4bf0de405a8c76d519aa2a5329dc6825777229a5d0 + b753a7825a89b95275f9c025e215343c6c88cd6690a221f8ae9ef675ee464dc7 + d118da410507ea5d6b6489dd60afd8a6646492db3e279f1a78240db8abbda6c5 + 0714c9636650a72081e7fa5d472c1428b07eae5d15b64ea1e2a7508512fe9ab6 + 55f86a313486d3cca1dd8e90acc5c9fba4d6e767507fbab9f3a7f68c748142af + 2a3701d31a8a9b7511958aa77187ba702ed934d385afcee42380e95e0e7e9bc0 + f4d23367fc770374167b7f0926fb6fdb6d05aad1cfd191824845b014e18153bf + 0d1d3c3b1fadbb25a3f1d151f9b684633d8c1690fcd8cad05aac2aeb23dbf19a + 37e480a008910319c116d47bd924b39942543b88a0f6127952b2d8e1290f3029 + f542aebe9c0c8e36cf3296865cd6643c8924d566ebf4971809399a1ac096fe1e + dc3b5f871bf5ef0b4d44e0ea27620d205142e0bfcf677b4db025532121a3f074 + 5aa4d0586331733257855a5cecbe3ac4403d04ff0cc0c58b7c04904b402125c2 + bc2a63a20ebb309cc6f3e65db301a058b8dace07e71b38f3f3595433f69b198f + 07 + 4.0.1.2.2 00000003 (3) + 4.0.1.2.2.0 010001 (65537) + 4.0.1.3 00000200 (512) + 4.0.1.3.0 (bytes) + 499f2c705e04bfe17a4476d27e5e1ddfd8c335f63ac22f748754f02183440f6d + a93f3f86429261663e0bddfda69d4c2f705d0bbe7dd31a8941bf5672e29844a1 + e0670970c6f2a98b76f85b26fafedb59c49786b8df7eaeeb86171fd579fe8df0 + eadd2536a4244a0332d5a9ad3eb8340c930464153e82b4ffad4f647a7ba808e3 + 854450f806b60e0b670fc99cb6b58786497d4c199e7750ee5089934eef25f465 + 12394955c487e10744ebdb9a00951c8095b024d4ce75f1da3146b5b3447169f5 + 9e23d40685438bc7bcad1173927a389a0903ba111a46809d123b3432197cca8f + c0c27816fbf215c2b7c584b94f37c9ed8a8e815942effdcf54757268afe58fd7 + 00cdcf6a98a20950617b0624aa835d95e27d7afcdee70c397ca1b6aa04735e6d + 5c5e01bfff2174cf562d36842624490e12ca8142595d52567494f38b2124012c + acacb2564e21c845eb94f5d6ebf6f39066e1fa04b318174e6f9994823ba4d9ef + 2c28b37cb3ea05fa3cad7200898394276835523e4e416054f23db0eb732211d3 + a11ea551390ae8d58d69e14664e0e20f2bf0ccd24d260b832a94144f5801ea7c + dbb2436f21ba2dbaecbcd573f24c5e0d43fd26b4ae6764e138ddaf4775ac0163 + e45727c10027f716cbe3cc70fff73441bb2538e5426a1a5638b448a7bde96804 + 1ec2184ef67b0da60070297cd73deeefebd1951611c7a776c956e18e5f163a21 + 4.0.1.4 00000100 (256) + 4.0.1.4.0 (bytes) + 0ae2e1cf2455a0d82272e6a42bbba83eb765496e5a33e13b8c94756d8c32f7d7 + 505fd997bdd5ec08c59bf8d1d659d1df02bec669ebb5aaaf5db1ec70ce2f2a6b + 3a17b7b1fce3adc6203c2905cd652d7622065dd011ae33894467c6dca3643952 + b0caedff9bc78ac40408074027566ee4c4751ad3ff452a2781af8b5c2c9bf09b + 34ee5e6201330b4bc381af766798667c5b9ad0733c19f4ef475fd264655e0305 + 53f2f2f8de59c2aee74b9dd6720e3108143dfedd41cf4bc11de2b9a9f40faec7 + 2a52312abee4c6155acfee9384a16348c715346ebe693895fe6d2348d4dedb0a + 137c487185ff949c209115b9c8a106329991f049e8430c7ba60dd5408d72ac98 + 4.0.1.5 00000101 (257) + 4.0.1.5.0 (bytes) + 00e50b65ba6ae4cb29ae66129c3e41ffeba36cd6ecbaa7045ff90cea71d09bc0 + 56b0b9134dc5754c49da1fe8ab169cd149eedaeccf4913d915f4f241c5fd86c7 + 7511e0c261c344600a84cce78e8cf493e492844cb82c42ab6d1246a53e5cf50a + d4759c2a5c09d53b1c5c3b449328eea01434d6e537b3a513928dfaddf0a72728 + 23899b8d795220cb3344ab8d0e846e1e40ffdfb5c719262c2b527a890a51faab + cf10904699135f7b997487f4b48d4490ad80fc25b346fa0bb587f09295bf0f71 + ac10a8086867d4bad00a0c27a6456f08e0c2bf8caed8768f0366a2440428180a + 292617af61feabab9a7075b8bc21209a5439bbfe3613917071fee74a8d5d80fe + 99 + 4.0.1.6 00000101 (257) + 4.0.1.6.0 (bytes) + 00cd7077659fad983104bcc7dc526242b9ea52cea40e923df771ac2a28e377f2 + b9231a58c2448c6b8d17fe83571ef6bdbbc11f3d4ab4254ea859684b8772911f + 9c6f355479053e3e3d3a6ecce13a016908298ca3f8b628d2111749a3627628eb + 05844f546795a5067d39b1d304e19cc6fc1be00a6164ea33e4abbc87f5683227 + 1d825c868c5ccda3775b037711e99436f96c53f3780b985084e1d84a458c687a + b0938a09bf6f9b3ffec41ed02fd5b27572c7d180039e405a559b62fc08f804b1 + 9f043dba4c6f7565b1c72759f4b932d4f93d4f41da91b1b146f29854a1008341 + e4760bdd4987097ec4a6551ab96e099a04a38d6a893b533db185abb55736419e + 9f + 4.0.1.7 00000018 (24) + 4.0.1.7.0 54686973206973206120636f6d6d656e7420737472696e67 ("This is a comment string") + 4.0.1.8 010203 ([1 2 3], 3 bytes) diff --git a/_ref/plain/public.ed25519 b/_ref/plain/public.ed25519 new file mode 100644 index 0000000..05c5248 --- /dev/null +++ b/_ref/plain/public.ed25519 @@ -0,0 +1,20 @@ +The following is a plaintext pubkey (no passphrase provided). + +Keys in the "PEM" (.pub) format are prefixed with the key type string and suffixed with the comment string. + +All length ints are uint32, network-byte order. + +PEM: +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEQ4i8lzaE3WaFcTESK/8hLJg7umsWLE6XzRH3PDnZew This is a test key + +HEX (only base64 string above): +00000000: 0000 000b 7373 682d 6564 3235 3531 3900 ....ssh-ed25519. +00000010: 0000 2044 388b c973 684d d668 5713 1122 .. D8..shM.hW.." +00000020: bff2 12c9 83bb a6b1 62c4 e97c d11f 73c3 ........b..|..s. +00000030: 9d97 b0 ... + +ANNOTATED HEX: +0 0000000b (11) + 0.0 7373682d65643235353139 ("ssh-ed25519") +1 00000020 (32) + 1.1 44388bc973684dd66857131122bff212c983bba6b162c4e97cd11f73c39d97b0 (bytes) diff --git a/_ref/plain/public.rsa b/_ref/plain/public.rsa new file mode 100644 index 0000000..1a606a7 --- /dev/null +++ b/_ref/plain/public.rsa @@ -0,0 +1,69 @@ +The following is a plaintext pubkey (no passphrase provided) (4096-bit). + +Keys in the "PEM" (.pub) format are prefixed with the key type string and suffixed with the comment string. + +All length ints are uint32, network-byte order. + +PEM: +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3zsBGAc4qEvDJJMuaMOuZAGaBLLFDaRk/MLK5/dSvyzAMkY8qd9ZEEPNheufIyjGMJX08TfTixBCLu+k6holLoUs1dfL3IVC8OB3L+3QsehloZv0xhKzpZ2Gt2g/CmS9shm11aZGfwi2cS/DeQFqMdtUZqipTKdxoJXdyKaXQt1OnglqJuVJ1+cAl4hU0PGyIzWaQoiH4rp72de5GTcfRGNpBBQfqXWtkid1gr9imZGSS2z4nnxp4JA24q72mxQcUyWNmUKcggef6XUcsFCiwfq5dFbZOoeKnUIUS/pq2VfhqMTSG08yh3Y6QrMXJ+6TW52dQf7q586f2jHSBQq8qNwHTGoqbdRGViqdxh7pwLtk004WvzuQjgOleDn6bwPTSM2f8dwN0Fnt/CSb7b9ttBarRz9GRgkhFsBThgVO/DR08Ox+tuyWj8dFR+baEYz2MFpD82MrQWqwq6yPb8Zo35ICgCJEDGcEW1HvZJLOZQlQ7iKD2EnlSstjhKQ8wKfVCrr6cDI42zzKWhlzWZDyJJNVm6/SXGAk5mhrAlv4e3Dtfhxv17wtNRODqJ2INIFFC4L/PZ3tNsCVTISGj8HRapNBYYzFzMleFWlzsvjrEQD0E/wzAxYt8BJBLQCElwrwqY6IOuzCcxvPmXbMBoFi42s4H5xs48/NZVDP2mxmPBw== This is a comment string + +HEX: +00000000: 0000 0007 7373 682d 7273 6100 0000 0301 ....ssh-rsa..... +00000010: 0001 0000 0201 00b7 cec0 4601 ce2a 12f0 ..........F..*.. +00000020: c924 cb9a 30eb 9900 6681 2cb1 4369 193f .$..0...f.,.Ci.? +00000030: 30b2 b9fd d4af cb30 0c91 8f2a 77d6 4410 0......0...*w.D. +00000040: f361 7ae7 c8ca 318c 257d 3c4d f4e2 c410 .az...1.%}'..x$ +000000d0: 0db8 abbd a6c5 0714 c963 6650 a720 81e7 .........cfP. .. +000000e0: fa5d 472c 1428 b07e ae5d 15b6 4ea1 e2a7 .]G,.(.~.]..N... +000000f0: 5085 12fe 9ab6 55f8 6a31 3486 d3cc a1dd P.....U.j14..... +00000100: 8e90 acc5 c9fb a4d6 e767 507f bab9 f3a7 .........gP..... +00000110: f68c 7481 42af 2a37 01d3 1a8a 9b75 1195 ..t.B.*7.....u.. +00000120: 8aa7 7187 ba70 2ed9 34d3 85af cee4 2380 ..q..p..4.....#. +00000130: e95e 0e7e 9bc0 f4d2 3367 fc77 0374 167b .^.~....3g.w.t.{ +00000140: 7f09 26fb 6fdb 6d05 aad1 cfd1 9182 4845 ..&.o.m.......HE +00000150: b014 e181 53bf 0d1d 3c3b 1fad bb25 a3f1 ....S...<;...%.. +00000160: d151 f9b6 8463 3d8c 1690 fcd8 cad0 5aac .Q...c=.......Z. +00000170: 2aeb 23db f19a 37e4 80a0 0891 0319 c116 *.#...7......... +00000180: d47b d924 b399 4254 3b88 a0f6 1279 52b2 .{.$..BT;....yR. +00000190: d8e1 290f 3029 f542 aebe 9c0c 8e36 cf32 ..).0).B.....6.2 +000001a0: 9686 5cd6 643c 8924 d566 ebf4 9718 0939 ..\.d<.$.f.....9 +000001b0: 9a1a c096 fe1e dc3b 5f87 1bf5 ef0b 4d44 .......;_.....MD +000001c0: e0ea 2762 0d20 5142 e0bf cf67 7b4d b025 ..'b. QB...g{M.% +000001d0: 5321 21a3 f074 5aa4 d058 6331 7332 5785 S!!..tZ..Xc1s2W. +000001e0: 5a5c ecbe 3ac4 403d 04ff 0cc0 c58b 7c04 Z\..:.@=......|. +000001f0: 904b 4021 25c2 bc2a 63a2 0ebb 309c c6f3 .K@!%..*c...0... +00000200: e65d b301 a058 b8da ce07 e71b 38f3 f359 .]...X......8..Y +00000210: 5433 f69b 198f 07 T3..... + +ANNOTATED HEX: +0 00000007 (7) + 0.0 7373682d727361 ("ssh-rsa") +1 00000003 (3) + 1.1 010001 (65537) +2 00000201 (513) + 2.0 (bytes) + 00b7cec04601ce2a12f0c924cb9a30eb990066812cb14369193f30b2b9fdd4af + cb300c918f2a77d64410f3617ae7c8ca318c257d3c4df4e2c4108bbbe93a8689 + 4ba14b3575f2f72150bc381dcbfb742c7a196866fd3184ace96761adda0fc299 + 2f6c866d7569919fc22d9c4bf0de405a8c76d519aa2a5329dc6825777229a5d0 + b753a7825a89b95275f9c025e215343c6c88cd6690a221f8ae9ef675ee464dc7 + d118da410507ea5d6b6489dd60afd8a6646492db3e279f1a78240db8abbda6c5 + 0714c9636650a72081e7fa5d472c1428b07eae5d15b64ea1e2a7508512fe9ab6 + 55f86a313486d3cca1dd8e90acc5c9fba4d6e767507fbab9f3a7f68c748142af + 2a3701d31a8a9b7511958aa77187ba702ed934d385afcee42380e95e0e7e9bc0 + f4d23367fc770374167b7f0926fb6fdb6d05aad1cfd191824845b014e18153bf + 0d1d3c3b1fadbb25a3f1d151f9b684633d8c1690fcd8cad05aac2aeb23dbf19a + 37e480a008910319c116d47bd924b39942543b88a0f6127952b2d8e1290f3029 + f542aebe9c0c8e36cf3296865cd6643c8924d566ebf4971809399a1ac096fe1e + dc3b5f871bf5ef0b4d44e0ea27620d205142e0bfcf677b4db025532121a3f074 + 5aa4d0586331733257855a5cecbe3ac4403d04ff0cc0c58b7c04904b402125c2 + bc2a63a20ebb309cc6f3e65db301a058b8dace07e71b38f3f3595433f69b198f + 07 diff --git a/_ref/sources b/_ref/sources new file mode 100644 index 0000000..bef4aac --- /dev/null +++ b/_ref/sources @@ -0,0 +1,51 @@ +https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key + canonical: https://cvsweb.openbsd.org/src/usr.bin/ssh/PROTOCOL.key?annotate=HEAD +https://peterlyons.com/problog/2017/12/openssh-ed25519-private-key-file-format/ +https://stackoverflow.com/a/56300901/733214 +https://stackoverflow.com/a/59283692/733214 +https://coolaj86.com/articles/the-openssh-private-key-format/ +https://coolaj86.com/articles/the-ssh-public-key-format/ +https://coolaj86.com/articles/openssh-vs-openssl-key-formats/ +https://coolaj86.com/articles/ssh-pubilc-key-fingerprints/ +https://crypto.stackexchange.com/a/40910 +https://flak.tedunangst.com/post/new-openssh-key-format-and-bcrypt-pbkdf +("(Technical note: PBKDF2, aka PKCS #5, supports pluggable hash functions, though in practice everybody uses HMAC-SHA1. The bcrypt pbkdf essentially is PBKDF2, but with bcrypt plugged into it instead.)" +http://www.tedunangst.com/flak/post/bcrypt-pbkdf +https://xorhash.gitlab.io/xhblog/0010.html +https://blog.rebased.pl/2020/02/10/ssh-key-internals.html +https://blog.rebased.pl/2020/03/24/basic-key-security.html +https://github.com/pwnedkeys/openssl-additions/blob/master/lib/openssl/ssh_pkey.rb +https://stackoverflow.com/a/25181584/733214 +https://crypto.stackexchange.com/a/68732 + +RSA: +d: 512 +n: 512 +p: 256 +q: 256 +QInv: 256 +d: 4.0.1.3.0 +n: 4.0.0.2.0, 4.0.1.2.1.0 (prefix nullbyte) +p: 4.0.1.5.0 (prefix nullbyte) +q: 4.0.1.6.0 (prefix nullbyte) +QInv: 4.0.1.4.0 + +## UPSTREAM +https://github.com/openssh/openssh-portable/blob/master/sshkey.c + funcs: + sshkey_generate (~L1714) + sshkey_private_to_blob2 (~L3833) + sshkey_private_to_fileblob (~L4413) +https://github.com/openssh/openssh-portable/blob/master/cipher.c + funcs: + cipher_ivlen +https://github.com/openssh/openssh-portable/blob/master/ed25519.c + funcs: + crypto_sign_ed25519_keypair (~L26) +https://github.com/openssh/openssh-portable/blob/master/authfile.c + funcs: + sshkey_save_private (~L68) + sshkey_save_private_blob (~L56) +https://github.com/openssh/openssh-portable/blob/master/ssh-keygen.c + funcs: + main (~L3145; ~L3673 onwards for key generation) \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..660cfe2 --- /dev/null +++ b/go.mod @@ -0,0 +1,7 @@ +module r00t2.io/sshkeys + +go 1.17 + +require github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a + +require golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..0faeeab --- /dev/null +++ b/go.sum @@ -0,0 +1,11 @@ +github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a h1:saTgr5tMLFnmy/yg3qDTft4rE5DY2uJ/cCxCe3q0XTU= +github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a/go.mod h1:Bw9BbhOJVNR+t0jCqx2GC6zv0TGBsShs56Y3gfSCvl0= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/internal/utils.go b/internal/utils.go new file mode 100644 index 0000000..ee717ee --- /dev/null +++ b/internal/utils.go @@ -0,0 +1,66 @@ +package internal + +import ( + "bytes" + "encoding/binary" +) + +/* + ReadSizeBytes returns a uint32 allocator for a given set of data for preparation of packing into bytes. + + data can be one of: + + - string + - byte/uint8 + - []byte/[]uint8 + - *bytes.Buffer + - *bytes.Reader + + If pack is true, the original data will be appended to the returned allocated *bytes.Reader. + + NOTE: If data is a *bytes.Reader, the bytes WILL be consumed within that reader. +*/ +func ReadSizeBytes(data interface{}, pack bool) (allocated *bytes.Reader, err error) { + + var u uint32 + var b []byte + var sizer []byte = make([]byte, 4) + + switch t := data.(type) { + case string: + b = []byte(t) + case byte: + // b = []byte{0x0, 0x0, 0x0, 0x1} + b = []byte{t} + case []byte: + b = t + case bytes.Buffer: + t2 := &t + b = t2.Bytes() + case *bytes.Buffer: + b = t.Bytes() + case bytes.Reader: + t2 := &t + b = make([]byte, t2.Len()) + if _, err = t2.Read(b); err != nil { + return + } + case *bytes.Reader: + b = make([]byte, t.Len()) + if _, err = t.Read(b); err != nil { + return + } + } + + u = uint32(len(b)) + + binary.BigEndian.PutUint32(sizer, u) + if !pack { + allocated = bytes.NewReader(sizer) + } else { + b = append(sizer, b...) + allocated = bytes.NewReader(b) + } + + return +} diff --git a/kdf/consts.go b/kdf/consts.go new file mode 100644 index 0000000..a0dc2e6 --- /dev/null +++ b/kdf/consts.go @@ -0,0 +1,9 @@ +package kdf + +var ( + // kdfNames is a collection of valid KDF name strings. + kdfNames []string = []string{ + "none", + "bcrypt", + } +) diff --git a/kdf/consts_bcrypt_pbkdf.go b/kdf/consts_bcrypt_pbkdf.go new file mode 100644 index 0000000..2bf1c89 --- /dev/null +++ b/kdf/consts_bcrypt_pbkdf.go @@ -0,0 +1,11 @@ +package kdf + +const ( + BcryptPbkdfName string = "bcrypt" + // BcryptPbkdfDefaultRounds is the default per OpenSSH, not per the bcrypt_pbkdf spec itself. It is recommended to use e.g. 100 rounds. + BcryptPbkdfDefaultRounds uint32 = 16 + // BcryptPbkdfDefaultSaltLen is the default per OpenSSH, not per the bcrypt_pbkdf spec itself. + BcryptPbkdfDefaultSaltLen int = 16 + // BcryptPbkdfDefaultKeyLen is suitable for AES256-CTR but may not be for others. TODO: revisit this and find something more flexible. + BcryptPbkdfDefaultKeyLen uint32 = 48 +) diff --git a/kdf/consts_null.go b/kdf/consts_null.go new file mode 100644 index 0000000..3ae5a3f --- /dev/null +++ b/kdf/consts_null.go @@ -0,0 +1,5 @@ +package kdf + +const ( + NullName string = "none" +) diff --git a/kdf/errs.go b/kdf/errs.go new file mode 100644 index 0000000..0321add --- /dev/null +++ b/kdf/errs.go @@ -0,0 +1,14 @@ +package kdf + +import ( + "errors" +) + +var ( + ErrBadData error = errors.New("unable to cast data into buffer for KDF") + ErrNoKeyLen error = errors.New("no key length configured or bad key length for KDF") + ErrNoRounds error = errors.New("no rounds number configured or bad number of rounds for KDF") + ErrNoSalt error = errors.New("no salt configured or bad salt value for KDF") + ErrNoSecret error = errors.New("no secret configured or bad secret value for KDF") + ErrUnknownKdf error = errors.New("unable to determine matching KDF") +) diff --git a/kdf/funcs.go b/kdf/funcs.go new file mode 100644 index 0000000..15563c2 --- /dev/null +++ b/kdf/funcs.go @@ -0,0 +1,42 @@ +package kdf + +import ( + "strings" +) + +/* + GetKDF returns a KDF from a name of the function. + + KDF.Setup must be called on the resulting KDF. +*/ +func GetKDF(name string) (k KDF, err error) { + + switch strings.ToLower(name) { + case BcryptPbkdfName: + k = &BcryptPbkdf{} + case NullName, "": + k = &Null{} + default: + err = ErrUnknownKdf + return + } + + return +} + +/* + UnpackKDF returns a KDF from raw data as packed in a private key's bytes. + + KDF.Setup must be called on the resulting KDF. + + data can be: + + - a []byte, which can be: + - the full private key bytes + - KDF section (e.g. _ref/format.ed25519 2.0 + (3.0 to 3.0.0.1) or 2.0.0 + (3.0 to 3.0.0.1)) + - a *bytes.Buffer, which supports the same as above +*/ +func UnpackKDF(data interface{}) (k KDF, err error) { + + return +} diff --git a/kdf/funcs_bcrypt_pbkdf.go b/kdf/funcs_bcrypt_pbkdf.go new file mode 100644 index 0000000..34dcc0c --- /dev/null +++ b/kdf/funcs_bcrypt_pbkdf.go @@ -0,0 +1,226 @@ +package kdf + +import ( + "bytes" + "crypto/rand" + "encoding/binary" + + bcryptPbkdf "github.com/dchest/bcrypt_pbkdf" + "r00t2.io/sshkeys/internal" +) + +/* + Setup must be called before DeriveKey. It configures a BcryptPbkdf. + + If secret is nil or an empty byte slice, ErrNoSecret will be returned. + + If salt is nil or an empty byte slice, one will be randomly generated of BcryptPbkdfDefaultSaltLen length. + + If rounds is 0, BcryptPbkdfDefaultRounds will be used. + + If keyLen is 0, BcryptPbkdfDefaultKeyLen will be used. +*/ +func (b *BcryptPbkdf) Setup(secret, salt []byte, rounds, keyLen uint32) (err error) { + + if secret == nil || len(secret) == 0 { + err = ErrNoSecret + return + } + + if salt == nil || len(salt) == 0 { + salt = make([]byte, BcryptPbkdfDefaultSaltLen) + if _, err = rand.Read(salt); err != nil { + return + } + } + + if rounds == 0 { + rounds = BcryptPbkdfDefaultRounds + } + + if keyLen == 0 { + keyLen = BcryptPbkdfDefaultKeyLen + } + + b.secret = secret + b.salt = salt + b.rounds = rounds + b.keyLen = keyLen + + return +} + +/* + SetupAuto is used to provide out-of-band configuration if the KDF options were found via GetKdfFromBytes. + + You can test this by running KDF.AutoOK. +*/ +func (b *BcryptPbkdf) SetupAuto(secret []byte, keyLen uint32) (err error) { + + if !b.AutoOK() { + err = ErrUnknownKdf + return + } + + if keyLen == 0 { + keyLen = BcryptPbkdfDefaultKeyLen + } + + b.secret = secret + b.keyLen = keyLen + + return +} + +/* + DeriveKey returns the derived key from a BcryptPbkdf. + + It must be called *after* Setup. +*/ +func (b *BcryptPbkdf) DeriveKey() (key []byte, err error) { + + if b.secret == nil { + err = ErrNoSecret + return + } + if b.salt == nil { + err = ErrNoSalt + return + } + if b.rounds == 0 { + err = ErrNoRounds + return + } + if b.keyLen == 0 { + err = ErrNoKeyLen + } + + if b.key, err = bcryptPbkdf.Key(b.secret, b.salt, int(b.rounds), int(b.keyLen)); err != nil { + return + } + + key = b.key + + return +} + +// Name returns BcryptPbkdfName. +func (b *BcryptPbkdf) Name() (name string) { + + name = BcryptPbkdfName + + return +} + +// NameBytes returns the byte form of BcryptPbkdf.Name with leading bytecount allocator. +func (b *BcryptPbkdf) NameBytes() (name []byte) { + + var nb []byte + var s string = b.Name() + + nb = []byte(s) + + name = make([]byte, 4) + binary.BigEndian.PutUint32(name, uint32(len(nb))) + name = append(name, nb...) + + return +} + +// PackedBytes returns 3.0 and recursed. +func (b *BcryptPbkdf) PackedBytes() (buf *bytes.Reader, err error) { + + var rounds []byte = make([]byte, 4) + var packer *bytes.Reader + var w *bytes.Buffer = new(bytes.Buffer) + + // 3.0.0.0 and 3.0.0.0.0 + if packer, err = internal.ReadSizeBytes(b.salt, true); err != nil { + return + } + if _, err = packer.WriteTo(w); err != nil { + return + } + + // 3.0.0.1 + binary.BigEndian.PutUint32(rounds, b.rounds) + if _, err = w.Write(rounds); err != nil { + return + } + + // 3.0 + if buf, err = internal.ReadSizeBytes(w, true); err != nil { + return + } + + return +} + +// Rounds returns the number of rounds used in derivation. +func (b *BcryptPbkdf) Rounds() (rounds uint32) { + + rounds = b.rounds + + return +} + +// Salt returns the salt bytes. +func (b *BcryptPbkdf) Salt() (salt []byte) { + + salt = b.salt + + return +} + +/* + AutoOK returns true if a GetKdfFromBytes call was able to fetch the KDF options successfully, in which case the caller may use KDF.SetupAuto. + + If false, it will need to be manually configured via KDF.Setup. +*/ +func (b *BcryptPbkdf) AutoOK() (ok bool) { + + ok = true + + if b.salt == nil || len(b.salt) == 0 { + ok = false + } + + if b.rounds == 0 { + ok = false + } + + return +} + +// IsPlain indicates if this KDF actually does derivation (false) or not (true). +func (b *BcryptPbkdf) IsPlain() (plain bool) { + + plain = false + + return +} + +// addSalt adds a salt as parsed from GetKdfFromBytes. +func (b *BcryptPbkdf) addSalt(salt []byte) (err error) { + + if salt == nil || len(salt) == 0 { + err = ErrNoSalt + return + } + b.salt = salt + + return +} + +// addRounds adds the rounds as parsed from GetKdfFromBytes +func (b *BcryptPbkdf) addRounds(rounds uint32) (err error) { + + if rounds == 0 { + err = ErrNoRounds + return + } + + b.rounds = rounds + + return +} diff --git a/kdf/funcs_null.go b/kdf/funcs_null.go new file mode 100644 index 0000000..ed3a883 --- /dev/null +++ b/kdf/funcs_null.go @@ -0,0 +1,137 @@ +package kdf + +import ( + "bytes" + "encoding/binary" +) + +/* + Setup must be called before DeriveKey. It configures a Null. + + Note that this doesn't actually do anything, it's here for interface compat. + It is recommended to use nil/zero values. +*/ +func (n *Null) Setup(secret, salt []byte, rounds, keyLen uint32) (err error) { + + _, _, _, _ = secret, salt, rounds, keyLen + + return +} + +/* + SetupAuto is used to provide out-of-band configuration if the KDF options were found via GetKdfFromBytes. + + Note that this doesn't actually do anything, it's here for interface compat. + It is recommended to use nil/zero values. +*/ +func (n *Null) SetupAuto(secret []byte, keyLen uint32) (err error) { + + _, _ = secret, keyLen + + return +} + +/* + DeriveKey returns the derived key from a Null. + + Note that this doesn't actually do anything, it's here for interface compat. + key will ALWAYS be a nil byte slice. +*/ +func (n *Null) DeriveKey() (key []byte, err error) { + + return +} + +// Name returns NullName. +func (n *Null) Name() (name string) { + + name = NullName + + return +} + +// NameBytes returns the byte form of Null.Name with leading bytecount allocator. +func (n *Null) NameBytes() (name []byte) { + + var b []byte + var s string = n.Name() + + b = []byte(s) + + name = make([]byte, 4) + binary.BigEndian.PutUint32(name, uint32(len(b))) + name = append(name, b...) + + return +} + +// PackedBytes returns 3.0 and recursed. +func (n *Null) PackedBytes() (buf *bytes.Reader, err error) { + + // This is static. + buf = bytes.NewReader([]byte{0x0, 0x0, 0x0, 0x0}) + + return +} + +/* + Rounds returns the number of rounds used in derivation. + + Note that this will always return 0; it's here for interface compat. +*/ +func (n *Null) Rounds() (rounds uint32) { + + rounds = 0 + + return +} + +/* + Salt returns the salt bytes. + + Note that this will always return nil; it's here for interface compat. +*/ +func (n *Null) Salt() (salt []byte) { + + salt = nil + + return +} + +/* + AutoOK returns true if a GetKdfFromBytes call was able to fetch the KDF options successfully, in which case the caller may use KDF.SetupAuto. + + If false, it will need to be manually configured via KDF.Setup. + + Note that this won't actually do anything and ok will always return as true. +*/ +func (n *Null) AutoOK() (ok bool) { + + ok = true + + return +} + +// IsPlain indicates if this KDF actually does derivation (false) or not (true). +func (n *Null) IsPlain() (plain bool) { + + plain = true + + return +} + +// addSalt is a no-op, just here for interface compat. +func (n *Null) addSalt(salt []byte) (err error) { + + _ = salt + + return +} + +// addRounds is a no-op; just here for interface compat. +func (n *Null) addRounds(rounds uint32) (err error) { + + _ = rounds + + return +} diff --git a/kdf/types.go b/kdf/types.go new file mode 100644 index 0000000..0b44c04 --- /dev/null +++ b/kdf/types.go @@ -0,0 +1,56 @@ +package kdf + +import ( + "bytes" +) + +// KDF is a type of KDF (Key Derivation Function). +type KDF interface { + // Name returns the string form of the KDF name. + Name() (name string) + // NameBytes returns the Name result but in bytes with a leading uint32 bytecount packed in. + NameBytes() (name []byte) + // Rounds returns the number of rounds used in derivation. + Rounds() (rounds uint32) + // Salt returns the salt bytes. + Salt() (salt []byte) + // Setup initializes the KDF with the given derivation secret (password) and KDF options. + Setup(secret, salt []byte, rounds, keyLen uint32) (err error) + // DeriveKey derives the key. Setup (or SetupAuto) must have been run first. + DeriveKey() (key []byte, err error) + // SetupAuto configures a partially reconstructed KDF options that were parsed from GetKdfFromBytes (if KDF.AutoOK returns true). + SetupAuto(secret []byte, keyLen uint32) (err error) + // AutoOK returns true if all components were able to be parsed from GetKdfFromBytes. + AutoOK() (ok bool) + // IsPlain returns true if this is a "null" kdf; i.e. no derivation is actually performed. + IsPlain() (plain bool) + // PackedBytes returns the bytes suitable for serializing into a key file. + PackedBytes() (buf *bytes.Reader, err error) + // addSalt adds the salt as parsed from the private key. + addSalt(salt []byte) (err error) + // addRounds adds the rounds as parsed from the private key. + addRounds(rounds uint32) (err error) +} + +/* + BcryptPbkdf combines bcrypt hashing algorithm with PBKDF2 key derivation. + + (bcrypt) https://www.usenix.org/legacy/events/usenix99/provos/provos_html/node1.html + (PBKDF2) https://datatracker.ietf.org/doc/html/rfc2898 + http://www.tedunangst.com/flak/post/bcrypt-pbkdf +*/ +type BcryptPbkdf struct { + // salt is used to salt the hash for each round in rounds. + salt []byte + // rounds controls how many iterations that salting/hashing is done. + rounds uint32 + // keyLen is how long the derived key should be in bytes. + keyLen uint32 + // secret is the "passphrase" used to seed the key creation. + secret []byte + // key is used to store the derived key. + key []byte +} + +// Null is a dummy KDF that is used for unencrypted/plain SSH private keys. It literally does nothing. +type Null struct{}