aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/crypto.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-04 17:08:30 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-04 17:45:22 +0100
commitaf7cdb1096dd12f0ca06d78f5e5a3f5e9f57b3a8 (patch)
tree1b8ff00a1183f12cd5d8f8b8ea445ec7d34c1d72 /src/libstore/crypto.hh
parent42bc395b63260e13f42e4bf348823799e78e445f (diff)
BinaryCacheStore: Remove publicKeyFile argument
The public key can be derived from the secret key, so there's no need for the user to supply it separately.
Diffstat (limited to 'src/libstore/crypto.hh')
-rw-r--r--src/libstore/crypto.hh12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstore/crypto.hh b/src/libstore/crypto.hh
index a1489e753..33b79cb2e 100644
--- a/src/libstore/crypto.hh
+++ b/src/libstore/crypto.hh
@@ -15,19 +15,31 @@ struct Key
‘<name>:<key-in-base64>’. */
Key(const std::string & s);
+protected:
+ Key(const std::string & name, const std::string & key)
+ : name(name), key(key) { }
};
+struct PublicKey;
+
struct SecretKey : Key
{
SecretKey(const std::string & s);
/* Return a detached signature of the given string. */
std::string signDetached(const std::string & s) const;
+
+ PublicKey toPublicKey() const;
};
struct PublicKey : Key
{
PublicKey(const std::string & data);
+
+private:
+ PublicKey(const std::string & name, const std::string & key)
+ : Key(name, key) { }
+ friend class SecretKey;
};
typedef std::map<std::string, PublicKey> PublicKeys;