func TestCheckSig(t *testing.T) { priv := testHelper.NewPrivKey(1) msg := []byte("Hello!") pub := testHelper.PrivateKeyToEDPub(priv) pre := []byte{0x01} pre = append(pre, pub...) id := primitives.Shad(pre) sig := primitives.Sign(priv, msg) if CheckSig(id, pub, msg, sig) == false { t.Error("Valid signature not valid") } sig[0] += 1 if CheckSig(id, pub, msg, sig) == true { t.Error("Invalid signature valid") } }
func NewED25519Signature(priv, data []byte) *FactoidSignature { sig := primitives.Sign(priv, data) fs := new(FactoidSignature) copy(fs.Signature[:], sig[:constants.SIGNATURE_LENGTH]) return fs }