package main import ( "crypto" "crypto/aes" "crypto/cipher" "crypto/ed25519" "encoding/hex" "fmt" "github.com/dchest/bcrypt_pbkdf" ) // ssh-keygen -f /tmp/tmp2xzvpjhn -q -o -t ed25519 -N test -a 100 // private /* on-disk format -----BEGIN OPENSSH PRIVATE KEY----- b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABAZQzNZ6B eWtpsLgQvGbcuMAAAAZAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIFjgZ791hHftK4GY uhnIN/1JdZqA17hIlNdKr+ljJ9bfAAAAoN0XZgxeA2SLXGZXqZi9TqeQHU7PERiJA9F0+p 2NtNP4Y1Rey8C1EnF5mhzy8AZs6YJsE+xnQUSI/+Kbmi6MACQALaPO7CgtKwnfbFHuxzrD 1EG83K08w2NE2txlQPqflQcFoVBIzcXNVFv+3A5DM7BBz0jLFi5CCwl2PEhMhcpElvV+LW PGXBV9IVdOeHm/hesRfuWTHcUalrqar1CmLWo= -----END OPENSSH PRIVATE KEY----- */ /* actual bytes (hex repr) 00000000: 6f 70 65 6e 73 73 68 2d 6b 65 79 2d 76 31 00 00 openssh-key-v1.. 00000010: 00 00 0a 61 65 73 32 35 36 2d 63 74 72 00 00 00 ...aes256-ctr... 00000020: 06 62 63 72 79 70 74 00 00 00 18 00 00 00 10 19 .bcrypt......... 00000030: 43 33 59 e8 17 96 b6 9b 0b 81 0b c6 6d cb 8c 00 C3Y.........m... 00000040: 00 00 64 00 00 00 01 00 00 00 33 00 00 00 0b 73 ..d.......3....s 00000050: 73 68 2d 65 64 32 35 35 31 39 00 00 00 20 58 e0 sh-ed25519... X. 00000060: 67 bf 75 84 77 ed 2b 81 98 ba 19 c8 37 fd 49 75 g.u.w.+.....7.Iu 00000070: 9a 80 d7 b8 48 94 d7 4a af e9 63 27 d6 df 00 00 ....H..J..c'.... 00000080: 00 a0 dd 17 66 0c 5e 03 64 8b 5c 66 57 a9 98 bd ....f.^.d.\fW... 00000090: 4e a7 90 1d 4e cf 11 18 89 03 d1 74 fa 9d 8d b4 N...N......t.... 000000a0: d3 f8 63 54 5e cb c0 b5 12 71 79 9a 1c f2 f0 06 ..cT^....qy..... 000000b0: 6c e9 82 6c 13 ec 67 41 44 88 ff e2 9b 9a 2e 8c l..l..gAD....... 000000c0: 00 24 00 2d a3 ce ec 28 2d 2b 09 df 6c 51 ee c7 .$.-...(-+..lQ.. 000000d0: 3a c3 d4 41 bc dc ad 3c c3 63 44 da dc 65 40 fa :..A...<.cD..e@. 000000e0: 9f 95 07 05 a1 50 48 cd c5 cd 54 5b fe dc 0e 43 .....PH...T[...C 000000f0: 33 b0 41 cf 48 cb 16 2e 42 0b 09 76 3c 48 4c 85 3.A.H...B..v