Commit 6ae56f89 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Correctly decide if session involves a keyshare server

Previously this was decided by checking whether any of the scheme managers of any of the involved credetials and attributes that occur in the session uses a keyshare server. However, in case of disclosure and signing sessions, this could erroneously include attributes from disjunctions that have not been selected by the user.
parent fcd35c73
......@@ -389,7 +389,7 @@ func (session *session) do(proceed bool) {
}
session.Handler.StatusUpdate(session.Action, irma.StatusCommunicating)
if !session.irmaSession.Identifiers().Distributed(session.client.Configuration) {
if !session.Distributed() {
message, err := session.getProof()
if err != nil {
session.fail(&irma.SessionError{ErrorType: irma.ErrorCrypto, Err: err})
......@@ -413,6 +413,31 @@ func (session *session) do(proceed bool) {
}
}
func (session *session) Distributed() bool {
var smi irma.SchemeManagerIdentifier
if session.Action == irma.ActionIssuing {
for _, credreq := range session.irmaSession.(*irma.IssuanceRequest).Credentials {
smi = credreq.CredentialTypeID.IssuerIdentifier().SchemeManagerIdentifier()
if session.client.Configuration.SchemeManagers[smi].Distributed() {
return true
}
}
}
if session.choice == nil || session.choice.Attributes == nil {
return false
}
for _, ai := range session.choice.Attributes {
smi = ai.Type.CredentialTypeIdentifier().IssuerIdentifier().SchemeManagerIdentifier()
if session.client.Configuration.SchemeManagers[smi].Distributed() {
return true
}
}
return false
}
func (session *session) KeyshareDone(message interface{}) {
session.sendResponse(message)
}
......
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