diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-02-09 15:09:39 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-02-10 11:33:33 +0100 |
commit | a596c525ad3ca86226cdb8094b91a578b23c1dae (patch) | |
tree | 04e09211da695cc2d2d72eac119be18dbd370c1c /src/nix-store | |
parent | 70cae879e3c3f5c3fba906ba5ec220f84cff1d61 (diff) |
Add base64 encoder/decoder
Diffstat (limited to 'src/nix-store')
-rw-r--r-- | src/nix-store/nix-store.cc | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 187397368..c59eb21fb 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -1023,14 +1023,8 @@ static void opGenerateBinaryCacheKey(Strings opFlags, Strings opArgs) if (crypto_sign_keypair(pk, sk) != 0) throw Error("key generation failed"); - // FIXME: super ugly way to do base64 encoding. - auto args = Strings({"-MMIME::Base64", "-0777", "-ne", "print encode_base64($_, '')"}); - - string pk64 = runProgram("perl", true, args, string((char *) pk, crypto_sign_PUBLICKEYBYTES)); - std::cout << keyName << ":" << pk64 << std::endl; - - string sk64 = runProgram("perl", true, args, string((char *) sk, crypto_sign_SECRETKEYBYTES)); - std::cout << keyName << ":" << sk64 << std::endl; + std::cout << keyName << ":" << base64Encode(string((char *) pk, crypto_sign_PUBLICKEYBYTES)) << std::endl; + std::cout << keyName << ":" << base64Encode(string((char *) sk, crypto_sign_SECRETKEYBYTES)) << std::endl; } |