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

feat: Add verification that the RingSig contains a specific Ring within #13

Open
h5law opened this issue Oct 8, 2023 · 1 comment
Open

Comments

@h5law
Copy link
Contributor

h5law commented Oct 8, 2023

Overview

Currently during the Verify method on the RingSig type we ensure the ring signature is valid. However, as long as the ring was valid on creation any signatures made with it indefinitely will be valid. I propose the following method to be added to ensure the RingSig has an up to date version of the ring. This is vital for our usecase where the ring is created via known data (available to all) and thus when verifying it we want to ensure the signer is using the latest copy of the ring (and they still have permission to be signing things)

func (ring *Ring) Equals(other *Ring) bool {
	for i, p := range ring.pubkeys {
		if eq := p.Equals(other.pubkeys[i]); !eq { return false }
	}
	bp, abp := ring.curve.BasePoint(), ring.curve.AltBasePoint()
	obp, oabp := other.curve.BasePoint(), other.curve.AltBasePoint()
	if eq := bp.Equals(obp); !eq { return false }
	if eq := abp.Equals(oabp); !eq { return false }
	return true
}

func (sig *RingSig) CheckRing(ring *Ring) bool {
	return sig.ring.Equals(ring)
}
@noot
Copy link
Owner

noot commented Oct 12, 2023

@h5law thanks for the issue, yeah this makes sense to add. I'd prefer something like:

func (ring *Ring) Equals(other *Ring) bool {
	// code here
}

func (sig *RingSig) Ring() *Ring {
	return sig.ring
}

so that the user can do sig.Ring().Equals(otherRing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants