Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add blind RSA protocol support #308

Merged
merged 1 commit into from
Dec 20, 2021
Merged

Add blind RSA protocol support #308

merged 1 commit into from
Dec 20, 2021

Conversation

chris-wood
Copy link
Contributor

@chris-wood chris-wood commented Dec 10, 2021

This change adds a generic interface for two-message blind signature protocols, along with a concrete implementation of the blind RSA protocol as currently being specified by the CFRG. This protocol is a very simple wrapper around the existing RSA implementation in the Go standard library.

I'm starting this as a draft PR since I have questions around how we might create signers and verifiers, and how the ergonomics of the API look:

  1. Should the RSASigner and RSAVerifier constructors accept crypto.rsa types as input, or more standardized formats for keying material (PKCS12 for private keys, for example)?
  2. Currently, one controls signature randomness by either supplying (or not) a source of randomness to the Blind function. If the randomness is nil, the signature is deterministic, and vice versa. Internally, we still always need a source of randomness to generate the blind, which we pull from crypto/rand. Does this sort of knob for controlling signature randomness make sense, or should we instead have a BlindDeterministic (or whatever) variant?
  3. Where do we stick the Go LICENSE file (which is required to reuse and modify their code)?
  4. ... there are probably other things we might want to ask ourselves =)

cc @wbl, @cjpatton, @claucece

Closes #307.

Copy link
Contributor

@cjpatton cjpatton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple comments to start. API looks sensible enough. One question I had is whether blind signatures that use techniques other than RSA would be able to implement this API?

blindsign/blindsign.go Outdated Show resolved Hide resolved
blindsign/blindsign.go Outdated Show resolved Hide resolved
blindsign/blindrsa/blindrsa.go Outdated Show resolved Hide resolved
@chris-wood
Copy link
Contributor Author

One question I had is whether blind signatures that use techniques other than RSA would be able to implement this API?

Yeah, I think so. I could prototype blind BLS using this API as a sanity check. We don't have a BLS implementation yet, as far as I know, so that would have to be in a separate PR. Sounds like a TODO project for the next couple of weeks!

blindsign/blindrsa/blindrsa_test.go Outdated Show resolved Hide resolved
blindsign/blindrsa/rsa.go Show resolved Hide resolved
blindsign/blindrsa/blindrsa.go Outdated Show resolved Hide resolved
blindsign/blindrsa/blindrsa.go Show resolved Hide resolved
@chris-wood chris-wood marked this pull request as ready for review December 16, 2021 23:30
@chris-wood
Copy link
Contributor Author

@cjpatton, @armfazh: I applied your suggestions. I think this PR is now ready for approval and merge. I'll squash before we merge.

@chris-wood
Copy link
Contributor Author

@armfazh is there a way to silence the linter that complains about use of math/rand? I'm using it to mock crypto/rand. Do we have a way to do this already?

@cjpatton
Copy link
Contributor

@armfazh is there a way to silence the linter that complains about use of math/rand? I'm using it to mock crypto/rand. Do we have a way to do this already?

It looks like your goal is to just have a deterministic stream of bits for testing purposes. You can do this by implementing your own io.Reader, which is all that crypto/rand.Reader is: https://pkg.go.dev/crypto/rand#pkg-variables

@chris-wood
Copy link
Contributor Author

It looks like your goal is to just have a deterministic stream of bits for testing purposes. You can do this by implementing your own io.Reader, which is all that crypto/rand.Reader is: https://pkg.go.dev/crypto/rand#pkg-variables

Oh, yes, duh. That is simpler. Pushed that change!

blindsign/blindrsa/blindrsa_test.go Outdated Show resolved Hide resolved
blindsign/blindrsa/blindrsa.go Outdated Show resolved Hide resolved
blindsign/blindrsa/blindrsa.go Show resolved Hide resolved
blindsign/blindrsa/blindrsa.go Show resolved Hide resolved
blindsign/blindrsa/blindrsa.go Outdated Show resolved Hide resolved
@chris-wood
Copy link
Contributor Author

@cjpatton suggestions applied, and the deterministic variant was dropped. Please let me know if more changes are needed!

This change adds a generic interface for two-message blind signature
protocols, along with a concrete implementation of the blind RSA
protocol as currently being specified by the CFRG. This protocol is
a very simple wrapper around the existing RSA implementation in the
Go standard library.
@armfazh armfazh self-assigned this Dec 20, 2021
@armfazh armfazh added the new feature New functionality or module label Dec 20, 2021
@chris-wood chris-wood merged commit 8147cc8 into master Dec 20, 2021
@chris-wood chris-wood deleted the caw/blind-rsa branch December 20, 2021 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New functionality or module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Two message blind signature protocols
3 participants