Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IRMA
Github mirrors
irmago
Commits
74788fa9
Commit
74788fa9
authored
Jun 24, 2019
by
Sietse Ringers
Browse files
fix: accept empty disclosures if consistent with the session request
parent
96c48fba
Changes
2
Hide whitespace changes
Inline
Side-by-side
internal/sessiontest/session_test.go
View file @
74788fa9
...
...
@@ -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
)
...
...
verify.go
View file @
74788fa9
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment