aboutsummaryrefslogtreecommitdiffstats
path: root/test/bls_if_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/bls_if_test.cpp')
-rw-r--r--test/bls_if_test.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/bls_if_test.cpp b/test/bls_if_test.cpp
new file mode 100644
index 0000000..6c6e549
--- /dev/null
+++ b/test/bls_if_test.cpp
@@ -0,0 +1,32 @@
+#include <cybozu/test.hpp>
+#include <bls_if.h>
+#include <string.h>
+
+CYBOZU_TEST_AUTO(bls_if)
+{
+ blsSecretKey *sec;
+ blsPublicKey *pub;
+ blsSign *sign;
+// blsId *id;
+ const char *msg = "this is a pen";
+ const size_t msgSize = strlen(msg);
+
+ blsInit();
+ sec = blsSecretKeyCreate();
+ blsSecretKeyInit(sec);
+ blsSecretKeyPut(sec);
+
+ pub = blsPublicKeyCreate();
+ blsSecretKeyGetPublicKey(sec, pub);
+ blsPublicKeyPut(pub);
+
+ sign = blsSignCreate();
+ blsSecretKeySign(sec, sign, msg, msgSize);
+ blsSignPut(sign);
+
+ printf("verify %d\n", blsSignVerify(sign, pub, msg, msgSize));
+
+ blsSignDestroy(sign);
+ blsPublicKeyDestroy(pub);
+ blsSecretKeyDestroy(sec);
+}