Commit 74788fa9 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

fix: accept empty disclosures if consistent with the session request

parent 96c48fba
......@@ -30,6 +30,25 @@ func TestNoAttributeDisclosureSession(t *testing.T) {
sessionHelper(t, request, "verification", nil)
}
func TestEmptyDisclosure(t *testing.T) {
// Disclosure request asking for an attribute value that the client doesn't have,
// and an empty conjunction as first option, which is always chosen by the test session handler
val := "client doesn't have this attr"
request := irma.NewDisclosureRequest()
request.Disclose = irma.AttributeConDisCon{
irma.AttributeDisCon{
irma.AttributeCon{},
irma.AttributeCon{{Type: irma.NewAttributeTypeIdentifier("irma-demo.RU.studentCard.level"), Value: &val}},
},
}
res := requestorSessionHelper(t, request, nil)
require.Nil(t, res.Err)
require.NotNil(t, res.SessionResult)
require.NotEmpty(t, res.SessionResult.Disclosed) // The outer conjunction was satisfied
require.Empty(t, res.SessionResult.Disclosed[0]) // by the empty set, so we get no attributes
}
func TestIssuanceSession(t *testing.T) {
id := irma.NewAttributeTypeIdentifier("irma-demo.RU.studentCard.studentID")
request := getCombinedIssuanceRequest(id)
......
......@@ -70,6 +70,11 @@ func (pl ProofList) ExtractPublicKeys(configuration *Configuration) ([]*gabi.Pub
// VerifyProofs verifies the proofs cryptographically.
func (pl ProofList) VerifyProofs(configuration *Configuration, context *big.Int, nonce *big.Int, publickeys []*gabi.PublicKey, isSig bool) (bool, error) {
// Empty proof lists are allowed (if consistent with the session request, which is checked elsewhere)
if len(pl) == 0 {
return true, nil
}
if publickeys == nil {
var err error
publickeys, err = pl.ExtractPublicKeys(configuration)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment