From a596c525ad3ca86226cdb8094b91a578b23c1dae Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 9 Feb 2015 15:09:39 +0100 Subject: Add base64 encoder/decoder --- src/nix-store/nix-store.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/nix-store') 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; } -- cgit v1.2.3