Commit d554ba44 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Fix handling of unexpected attributes in verification

parent 2bbe836a
...@@ -369,6 +369,7 @@ func (sr *SignatureRequest) SignatureFromMessage(message interface{}) (*SignedMe ...@@ -369,6 +369,7 @@ func (sr *SignatureRequest) SignatureFromMessage(message interface{}) (*SignedMe
return &SignedMessage{ return &SignedMessage{
Signature: signature.Proofs, Signature: signature.Proofs,
Indices: signature.Indices,
Nonce: sr.Nonce, Nonce: sr.Nonce,
Context: sr.Context, Context: sr.Context,
Message: sr.Message, Message: sr.Message,
......
...@@ -138,11 +138,6 @@ func (d *Disclosure) DisclosedAttributes(configuration *Configuration, disjuncti ...@@ -138,11 +138,6 @@ func (d *Disclosure) DisclosedAttributes(configuration *Configuration, disjuncti
return false, nil, errors.New("ProofList contained proof of invalid type") return false, nil, errors.New("ProofList contained proof of invalid type")
} }
if usedAttrs[index.CredentialIndex] == nil {
usedAttrs[index.CredentialIndex] = map[int]struct{}{}
}
usedAttrs[index.CredentialIndex][index.AttributeIndex] = struct{}{}
metadata := MetadataFromInt(proofd.ADisclosed[1], configuration) // index 1 is metadata attribute metadata := MetadataFromInt(proofd.ADisclosed[1], configuration) // index 1 is metadata attribute
attr, attrval, err := parseAttribute(index.AttributeIndex, metadata, proofd.ADisclosed[index.AttributeIndex]) attr, attrval, err := parseAttribute(index.AttributeIndex, metadata, proofd.ADisclosed[index.AttributeIndex])
if err != nil { if err != nil {
...@@ -156,6 +151,10 @@ func (d *Disclosure) DisclosedAttributes(configuration *Configuration, disjuncti ...@@ -156,6 +151,10 @@ func (d *Disclosure) DisclosedAttributes(configuration *Configuration, disjuncti
} else { } else {
list[i].Status = AttributeProofStatusInvalidValue list[i].Status = AttributeProofStatusInvalidValue
} }
if usedAttrs[index.CredentialIndex] == nil {
usedAttrs[index.CredentialIndex] = map[int]struct{}{}
}
usedAttrs[index.CredentialIndex][index.AttributeIndex] = struct{}{}
} else { } else {
list[i] = &DisclosedAttribute{Status: AttributeProofStatusMissing} list[i] = &DisclosedAttribute{Status: AttributeProofStatusMissing}
} }
...@@ -266,6 +265,7 @@ func (pl ProofList) DisclosedAttributes(configuration *Configuration, disjunctio ...@@ -266,6 +265,7 @@ func (pl ProofList) DisclosedAttributes(configuration *Configuration, disjunctio
// Any attributes still in here do not satisfy any of the specified disjunctions; append them now // Any attributes still in here do not satisfy any of the specified disjunctions; append them now
for _, attr := range extraAttrs { for _, attr := range extraAttrs {
attr.Status = AttributeProofStatusExtra
list = append(list, attr) list = append(list, attr)
} }
......
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