Description
Running vault in dev mode
$ vault -version
Vault v0.5.2
Then, write a binary file into vault:
$ vault write secret/burp/cert certificate=@/Users/jaxley/Downloads/burp-certificate.crt
And immediately read it back out:
$ vault read -field=certificate secret/burp/cert > ~/Downloads/burp-from-vault.crt
However, the file is munged and does not equal the original:
$ shasum ~/Downloads/burp-certificate.crt
78c77667f95f216b1543f78fa159159c264de96f /Users/jaxley/Downloads/burp-certificate.crt
$ shasum ~/Downloads/burp-from-vault.crt
7d2b76083030af92c0d061c91a64873791b7fb23 /Users/jaxley/Downloads/burp-from-vault.crt
Not sure if the issue is how the file is represented on the way in or out, but here is a sample of what the JSON looks like when reading via the API:
GET /v1/secret/burp/cert
...
"data": {
"certificate": "0?\u0002?0?\u0002-?\u0003\u0002\u0001\u0002\u0002\u0004U???0\r\u0006\t*?H??\r\u0001\u0001\u0005\u0005...
And a diff of the bytes:
$ hexdump ~/Downloads/burp-certificate.crt
0000000 30 82 02 c4 30 82 02 2d a0 03 02 01 02 02 04 55
0000010 f0 9a 88 30 0d 06 09 2a 86 48 86 f7 0d 01 01 05
0000020 05 00 30 81 8a 31 14 30 12 06 03 55 04 06 13 0b
0000030 50 6f 72 74 53 77 69 67 67 65 72 31 14 30 12 06
0000040 03 55 04 08 13 0b 50 6f 72 74 53 77 69 67 67 65
0000050 72 31 14 30 12 06 03 55 04 07 13 0b 50 6f 72 74
0000060 53 77 69 67 67 65 72 31 14 30 12 06 03 55 04 0a
....
$ hexdump ~/Downloads/burp-from-vault.crt
0000000 30 ef bf bd 02 ef bf bd 30 ef bf bd 02 2d ef bf
0000010 bd 03 02 01 02 02 04 55 ef bf bd ef bf bd ef bf
0000020 bd 30 0d 06 09 2a ef bf bd 48 ef bf bd ef bf bd
0000030 0d 01 01 05 05 00 30 ef bf bd ef bf bd 31 14 30
0000040 12 06 03 55 04 06 13 0b 50 6f 72 74 53 77 69 67
0000050 67 65 72 31 14 30 12 06 03 55 04 08 13 0b 50 6f
0000060 72 74 53 77 69 67 67 65 72 31 14 30 12 06 03 55
....
I saw some older issues about binary data that seemed to indicate this was fixed, such as:
#205
#583
But it doesn't seem like the CLI properly handles this. Does the API? I presume the CLI is supposedly encoding the binary data inside the JSON request that callers directly using the API would have to mimic.
Activity