aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2016-08-21 18:32:27 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2016-08-21 18:32:27 +0800
commit75feb28f07333d7544c30841acd9771fa9db334a (patch)
tree0c5ec113ae7cb26cfe7701b44e7ba035ed1dcaf7
parentea6f25a66e68550352f7fff40329195b1f1d6373 (diff)
downloaddexon-bls-75feb28f07333d7544c30841acd9771fa9db334a.tar
dexon-bls-75feb28f07333d7544c30841acd9771fa9db334a.tar.gz
dexon-bls-75feb28f07333d7544c30841acd9771fa9db334a.tar.bz2
dexon-bls-75feb28f07333d7544c30841acd9771fa9db334a.tar.lz
dexon-bls-75feb28f07333d7544c30841acd9771fa9db334a.tar.xz
dexon-bls-75feb28f07333d7544c30841acd9771fa9db334a.tar.zst
dexon-bls-75feb28f07333d7544c30841acd9771fa9db334a.zip
add document
-rw-r--r--readme.md75
1 files changed, 75 insertions, 0 deletions
diff --git a/readme.md b/readme.md
index 4fb6e3a..72b3b2d 100644
--- a/readme.md
+++ b/readme.md
@@ -25,6 +25,81 @@ To make sample programs, run
make sample_test
```
+# API
+
+## Basic API
+
+BLS signature
+```
+e : G2 x G1 -> Fp12 ; optimal ate pairing over BN curve
+Q in G2 ; fixed global parameter
+H : {str} -> G1
+s in Fr: secret key
+sQ in G2; public key
+s H(m) in G1; signature of m
+verify ; e(sQ, H(m)) = e(Q, s H(m))
+``
+
+```
+void bls::init();
+```
+Initialize this library. Call this once to use the other api.
+
+```
+void SecretKey::init();
+```
+Initialize the instance of SecretKey. `s` is a random number.
+
+```
+void SecretKey::getPublicKey(PublicKey& pub) const;
+```
+Get public key `sQ` for the secret key `s`.
+
+```
+void SecretKey::sign(Sign& sign, const std::string& m) const
+```
+Make sign `s H(m)` from message m.
+
+```
+bool Sign::verify(const PublicKey& pub, const std::string& m) const
+```
+Verify sign with pub and m and return true if it is valid.
+```
+e(sQ, H(m)) == e(Q, s H(m))
+```
+
+### Secret Sharing API
+
+```
+void SecretKey::getMasterSecretKey(SecretKeyVec& msk, int k) const
+```
+Prepare k-out-of-n secret sharing for the secret key.
+`msk[0]` is the original secret key `s` and `msk[i]` for i > 0 are random secret key.
+
+```
+void SecretKey::set(const SecretKeyVec& msk, int id)
+```
+Make secret key f(id) from msk and id where f(x) = msk[0] + msk[1] x + ... + msk[k-1] x^{k-1}.
+
+You can make a public key `f(id)Q` from each secret key f(id) for id != 0 and sign a message.
+
+```
+void Sign::recover(const SignVec& signVec);
+```
+Collect k sign `f(id) H(m)` for a message m and recover the original signature `s H(m)` for the secret key `s`.
+
+### PoP (Proof of Possesion)
+
+```
+void SecretKey::getPop(Sign& pop, const PublicKey& pub) const
+```
+Sign pub.getStr() and make a pop `s H(sQ)`
+
+```
+bool Sign::verify(const PublicKey& pub) const
+```
+Verify a public key by pop.
+
# License
modified new BSD License