about summary refs log tree commit diff
path: root/src/nix-store/nix-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-02-09T14·09+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-02-10T10·33+0100
commita596c525ad3ca86226cdb8094b91a578b23c1dae (patch)
tree04e09211da695cc2d2d72eac119be18dbd370c1c /src/nix-store/nix-store.cc
parent70cae879e3c3f5c3fba906ba5ec220f84cff1d61 (diff)
Add base64 encoder/decoder
Diffstat (limited to 'src/nix-store/nix-store.cc')
-rw-r--r--src/nix-store/nix-store.cc10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 18739736838e..c59eb21fb456 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;
 }