richardschneider / ipfs-encryption

Encrypting IPFS data
MIT License
18 stars 4 forks source link

Import/Export key #14

Closed richardschneider closed 6 years ago

richardschneider commented 6 years ago

Allow a key to be exported, with a password, so that other keystores #2 can use it.

Allow importing of a key.

Keys are in encrypted PKCS 8 PEM format.

richardschneider commented 6 years ago

An exported key exported-key.pem.txt

openssl asn1parse -in exported-key.pem -inform PEM

0:d=0  hl=4 l=1336 cons: SEQUENCE
4:d=1  hl=2 l=  98 cons: SEQUENCE
6:d=2  hl=2 l=   9 prim: OBJECT            :PBES2
17:d=2  hl=2 l=  85 cons: SEQUENCE
19:d=3  hl=2 l=  52 cons: SEQUENCE
21:d=4  hl=2 l=   9 prim: OBJECT            :PBKDF2
32:d=4  hl=2 l=  39 cons: SEQUENCE
34:d=5  hl=2 l=  16 prim: OCTET STRING      [HEX DUMP]:0BA33BC13D14B728836E33E3ACAFA784
52:d=5  hl=2 l=   2 prim: INTEGER           :2710
56:d=5  hl=2 l=   1 prim: INTEGER           :20
59:d=5  hl=2 l=  12 cons: SEQUENCE
61:d=6  hl=2 l=   8 prim: OBJECT            :hmacWithSHA512
71:d=6  hl=2 l=   0 prim: NULL
73:d=3  hl=2 l=  29 cons: SEQUENCE
75:d=4  hl=2 l=   9 prim: OBJECT            :aes-256-cbc
86:d=4  hl=2 l=  16 prim: OCTET STRING      [HEX DUMP]:2A6FCC60C0B3AEEF26D71D9EDA1C464A
104:d=1  hl=4 l=1232 prim: OCTET STRING      [HEX DUMP]:1A5CD ...