summaryrefslogtreecommitdiff
path: root/node/Network.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-07-29 16:18:29 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-07-29 16:18:29 -0400
commit439e602d5a5712d1b33fb19d558d0e9fdf784703 (patch)
treef6f5dcb2c76fd13e67106e3241373595730dc70a /node/Network.hpp
parenta53cfc909638ea9eeb2bd477cee20d106f79bf6d (diff)
downloadinfinitytier-439e602d5a5712d1b33fb19d558d0e9fdf784703.tar.gz
infinitytier-439e602d5a5712d1b33fb19d558d0e9fdf784703.zip
Fix a bunch of errors due to minor method signature changes, still a work in progress.
Diffstat (limited to 'node/Network.hpp')
-rw-r--r--node/Network.hpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/node/Network.hpp b/node/Network.hpp
index 359e2ce5..c13f00a4 100644
--- a/node/Network.hpp
+++ b/node/Network.hpp
@@ -129,7 +129,7 @@ public:
}
/**
- * Set the timestamp and max-delta
+ * Set the timestamp and timestamp max-delta
*
* @param ts Timestamp in ms since epoch
* @param maxDelta Maximum difference between two peers on the same network
@@ -144,11 +144,31 @@ public:
}
/**
- * Set or update the sig field to contain a signature
+ * Sign this certificate
*
* @param with Signing identity -- the identity of this network's controller
+ * @return Signature or empty string on failure
*/
- void sign(const Identity &with);
+ inline std::string sign(const Identity &with) const
+ {
+ unsigned char dig[32];
+ _shaForSignature(dig);
+ return with.sign(dig);
+ }
+
+ /**
+ * Verify this certificate's signature
+ *
+ * @param with Signing identity -- the identity of this network's controller
+ * @param sig Signature
+ * @param siglen Length of signature in bytes
+ */
+ inline bool verify(const Identity &with,const void *sig,unsigned int siglen) const
+ {
+ unsigned char dig[32];
+ _shaForSignature(dig);
+ return with.verifySignature(dig,sig,siglen);
+ }
/**
* Check if another peer is indeed a current member of this network
@@ -157,13 +177,15 @@ public:
* delta in this certificate. Fields without ~fields are compared for
* equality.
*
- * This does not verify the certificate's signature! The signature
- * must be verified first.
+ * This does not verify the certificate's signature!
*
* @param mc Peer membership certificate
* @return True if mc's membership in this network is current
*/
bool qualifyMembership(const Certificate &mc) const;
+
+ private:
+ void _shaForSignature(unsigned char *dig) const;
};
/**