You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.4 KiB

3 years ago
  1. # go-blindsecp256k1 [![GoDoc](https://godoc.org/github.com/arnaucube/go-blindsecp256k1?status.svg)](https://godoc.org/github.com/arnaucube/go-blindsecp256k1) [![Go Report Card](https://goreportcard.com/badge/github.com/arnaucube/go-blindsecp256k1)](https://goreportcard.com/report/github.com/arnaucube/go-blindsecp256k1) [![Test](https://github.com/arnaucube/go-blindsecp256k1/workflows/Test/badge.svg)](https://github.com/arnaucube/go-blindsecp256k1/actions?query=workflow%3ATest)
  2. Blind signature over [secp256k1](https://en.bitcoin.it/wiki/Secp256k1), based on *"[An Efficient Blind Signature Scheme Based on the Elliptic Curve Discrete Logarithm Problem](http://www.isecure-journal.com/article_39171_47f9ec605dd3918c2793565ec21fcd7a.pdf)"* paper.
  3. **WARNING**: this repo is experimental, do not use in production.
  4. ## Usage
  5. ```go
  6. // message to be signed
  7. msg := new(big.Int).SetBytes([]byte("test"))
  8. // create new signer
  9. signerPrivateData := blindsecp256k1.NewSigner()
  10. signerPublicData := signerPrivateData.PublicData()
  11. // user blinds the msg
  12. msgBlinded, user := blindsecp256k1.Blind(msg, signerPublicData)
  13. // signer signs the blinded message
  14. sBlind := signerPrivateData.BlindSign(msgBlinded)
  15. // user unblinds the blinded signature
  16. sig := blindsecp256k1.Unblind(sBlind, msg, user)
  17. // signature can be verified with signer PublicKey
  18. verified := blindsecp256k1.Verify(msg, sig, signerPublicData.Q)
  19. assert.True(t, verified)
  20. ```