From 456284a6972aa7bb499a65a1292ebd8ae298897f Mon Sep 17 00:00:00 2001 From: brent s Date: Thu, 3 Sep 2020 19:11:42 -0400 Subject: [PATCH] checking in --- const.go | 7 ++++ go.mod | 3 ++ sshkeys/const.go | 21 ++++++++++ sshkeys/main.go | 5 +++ sshkeys/notes | 102 ++++++++++++++++++++++++++++++++++++++++++++++ sshkeys/struct.go | 11 +++++ 6 files changed, 149 insertions(+) create mode 100644 const.go create mode 100644 go.mod create mode 100644 sshkeys/const.go create mode 100644 sshkeys/main.go create mode 100644 sshkeys/notes create mode 100644 sshkeys/struct.go diff --git a/const.go b/const.go new file mode 100644 index 0000000..cd61d9d --- /dev/null +++ b/const.go @@ -0,0 +1,7 @@ +package sshsecure + +const ( + RoundsDefUser uint = 100 + RoundsDefHost uint = 0 // 0 = Default rounds + RSABitSize uint = 4096 +) \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..ef12c7c --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.square-r00t.net/sshsecure + +go 1.15 diff --git a/sshkeys/const.go b/sshkeys/const.go new file mode 100644 index 0000000..75dc869 --- /dev/null +++ b/sshkeys/const.go @@ -0,0 +1,21 @@ +package sshkeys + +// https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key + +const ( + AuthMagic string = "openssh-key-v1" +) + +type EncryptedSSHKey2 struct { + SSHKey2 + Salt string + Rounds uint32 +} +type SSHKey2 struct { + CipherName string + KDFName string + KDFOpts string + NumKeys int + Keys []string + Encrypted []string +} diff --git a/sshkeys/main.go b/sshkeys/main.go new file mode 100644 index 0000000..2397836 --- /dev/null +++ b/sshkeys/main.go @@ -0,0 +1,5 @@ +package sshkeys + +func main() { + +} diff --git a/sshkeys/notes b/sshkeys/notes new file mode 100644 index 0000000..502f3fb --- /dev/null +++ b/sshkeys/notes @@ -0,0 +1,102 @@ + +# PLAINTEXT +The following is a plaintext key (no passphrase provided). + +## Private + +### Private ("PEM"-like format): + +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACBEOIvJc2hN1mhXExEiv/ISyYO7prFixOl80R9zw52XsAAAAJjPbUqwz21K +sAAAAAtzc2gtZWQyNTUxOQAAACBEOIvJc2hN1mhXExEiv/ISyYO7prFixOl80R9zw52XsA +AAAEBqSF+KwoLTOqI6+TnpcaZY4ckcamLrBF8CvtJbNZflJ0Q4i8lzaE3WaFcTESK/8hLJ +g7umsWLE6XzRH3PDnZewAAAAElRoaXMgaXMgYSB0ZXN0IGtleQECAw== +-----END OPENSSH PRIVATE KEY----- + +### Private (Hex): + +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... + + +## Public + +### .pub format + +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEQ4i8lzaE3WaFcTESK/8hLJg7umsWLE6XzRH3PDnZew This is a test key + +### Hex + +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 ... + + +# ENCRYPTED + +The following uses the bcrypt encryption. The passphrase is "test". + +## Private + +### "PEM"-like format + +-----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. + + +## Public + +### .pub format + +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 .@. \ No newline at end of file diff --git a/sshkeys/struct.go b/sshkeys/struct.go new file mode 100644 index 0000000..6e2f3e6 --- /dev/null +++ b/sshkeys/struct.go @@ -0,0 +1,11 @@ +package sshkeys + +type SSHPubkey struct { + // Raw ??? + B64 string + Comment string +} + +type SSHPrivateKey struct { + +}