summaryrefslogtreecommitdiff
path: root/node/C25519.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-09-13 17:32:00 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-09-13 17:32:00 -0400
commitb2bb7b41fc3b1c5f33afbbe685064ee4442efe85 (patch)
tree4bd6b5fd2e2dabb003ffd64d389901212d7a0b39 /node/C25519.hpp
parent0b94a04914220b2adf50527bc4738175c0e8bf1f (diff)
downloadinfinitytier-b2bb7b41fc3b1c5f33afbbe685064ee4442efe85.tar.gz
infinitytier-b2bb7b41fc3b1c5f33afbbe685064ee4442efe85.zip
More work in progress on new crypto...
Diffstat (limited to 'node/C25519.hpp')
-rw-r--r--node/C25519.hpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/node/C25519.hpp b/node/C25519.hpp
index 9880035a..1260b9e1 100644
--- a/node/C25519.hpp
+++ b/node/C25519.hpp
@@ -32,14 +32,31 @@
namespace ZeroTier {
+#define ZT_C25519_PUBLIC_KEY_LEN 64
+
+#define ZT_C25519_PRIVATE_KEY_LEN 64
+
+#define ZT_C25519_SIGNATURE_LEN 96
+
/**
* C25519 elliptic curve key agreement and signing
*/
class C25519
{
public:
- typedef Array<unsigned char,64> Public; // crypto key, signing key
- typedef Array<unsigned char,96> Private; // crypto key, signing key (64 bytes)
+ /**
+ * Public key (both crypto and signing)
+ */
+ typedef Array<unsigned char,64> Public; // crypto key, signing key (both 32 bytes)
+
+ /**
+ * Private key (both crypto and signing)
+ */
+ typedef Array<unsigned char,64> Private; // crypto key, signing key (both 32 bytes)
+
+ /**
+ * Public/private key pair
+ */
typedef struct {
Public pub;
Private priv;
@@ -48,7 +65,8 @@ public:
/**
* Generate a C25519 elliptic curve key pair
*/
- static Pair generate();
+ static Pair generate()
+ throw();
/**
* Perform C25519 ECC key agreement
@@ -61,7 +79,14 @@ public:
* @param keybuf Buffer to fill
* @param keylen Number of key bytes to generate
*/
- static void agree(const Pair &mine,const Public &their,void *keybuf,unsigned int keylen);
+ static void agree(const Pair &mine,const Public &their,void *keybuf,unsigned int keylen)
+ throw();
+
+ static void sign(const Pair &mine,const void *msg,unsigned int len,void *signature)
+ throw();
+
+ static bool verify(const Public &their,const void *msg,unsigned int len,const void *signature)
+ throw();
};
} // namespace ZeroTier