Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
irmago
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
IRMA
Github mirrors
irmago
Commits
05c915e1
Commit
05c915e1
authored
Jan 11, 2020
by
Sietse Ringers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: pass witness into updated gabi issuance api
C.f. privacybydesign/gabi#3
parent
6af7c6ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
18 deletions
+16
-18
internal/servercore/handle.go
internal/servercore/handle.go
+2
-2
internal/servercore/helpers.go
internal/servercore/helpers.go
+14
-16
No files found.
internal/servercore/handle.go
View file @
05c915e1
...
...
@@ -199,11 +199,11 @@ func (session *session) handlePostCommitments(commitments *irma.IssueCommitmentM
if
err
!=
nil
{
return
nil
,
session
.
fail
(
server
.
ErrorIssuanceFailed
,
err
.
Error
())
}
witness
,
nonrevAttr
,
err
:=
session
.
issuanceHandleRevocation
(
cred
,
attributes
,
sk
)
witness
,
err
:=
session
.
issuanceHandleRevocation
(
cred
,
attributes
,
sk
)
if
err
!=
nil
{
return
nil
,
session
.
fail
(
server
.
ErrorIssuanceFailed
,
err
.
Error
())
// TODO error type
}
sig
,
err
:=
issuer
.
IssueSignature
(
proof
.
U
,
attributes
.
Ints
,
nonrevAttr
,
commitments
.
Nonce2
)
sig
,
err
:=
issuer
.
IssueSignature
(
proof
.
U
,
attributes
.
Ints
,
witness
,
commitments
.
Nonce2
)
if
err
!=
nil
{
return
nil
,
session
.
fail
(
server
.
ErrorIssuanceFailed
,
err
.
Error
())
}
...
...
internal/servercore/helpers.go
View file @
05c915e1
...
...
@@ -11,7 +11,6 @@ import (
"github.com/dgrijalva/jwt-go"
"github.com/go-errors/errors"
"github.com/privacybydesign/gabi"
"github.com/privacybydesign/gabi/big"
"github.com/privacybydesign/gabi/revocation"
"github.com/privacybydesign/irmago"
"github.com/privacybydesign/irmago/server"
...
...
@@ -78,16 +77,16 @@ func (session *session) checkCache(message []byte, expectedStatus server.Status)
func
(
session
*
session
)
issuanceHandleRevocation
(
cred
*
irma
.
CredentialRequest
,
attributes
*
irma
.
AttributeList
,
sk
*
gabi
.
PrivateKey
,
)
(
witness
*
revocation
.
Witness
,
nonrevAttr
*
big
.
Int
,
err
error
)
{
)
(
*
revocation
.
Witness
,
error
)
{
id
:=
cred
.
CredentialTypeID
if
!
session
.
conf
.
IrmaConfiguration
.
CredentialTypes
[
id
]
.
SupportsRevocation
()
{
return
return
nil
,
nil
}
// ensure the client always gets an up to date nonrevocation witness
if
settings
,
ok
:=
session
.
conf
.
RevocationSettings
[
id
];
!
ok
||
settings
.
Mode
!=
irma
.
RevocationModeServer
{
if
err
=
session
.
conf
.
IrmaConfiguration
.
Revocation
.
UpdateDB
(
id
);
err
!=
nil
{
return
if
err
:
=
session
.
conf
.
IrmaConfiguration
.
Revocation
.
UpdateDB
(
id
);
err
!=
nil
{
return
nil
,
err
}
}
...
...
@@ -97,38 +96,37 @@ func (session *session) issuanceHandleRevocation(
// from it to generate the witness from
updates
,
err
:=
rs
.
UpdateLatest
(
id
,
0
)
if
err
!=
nil
{
return
return
nil
,
err
}
u
:=
updates
[
uint
(
cred
.
KeyCounter
)
]
u
:=
updates
[
cred
.
KeyCounter
]
if
u
==
nil
{
return
nil
,
nil
,
errors
.
Errorf
(
"no revocation updates found for key %d"
,
cred
.
KeyCounter
)
return
nil
,
errors
.
Errorf
(
"no revocation updates found for key %d"
,
cred
.
KeyCounter
)
}
sig
:=
u
.
SignedAccumulator
pk
,
err
:=
rs
.
Keys
.
PublicKey
(
id
.
IssuerIdentifier
(),
sig
.
PKCounter
)
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
acc
,
err
:=
sig
.
UnmarshalVerify
(
pk
)
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
if
witness
,
err
=
sk
.
RevocationGenerateWitness
(
acc
);
err
!=
nil
{
return
witness
,
err
:=
sk
.
RevocationGenerateWitness
(
acc
)
if
err
!=
nil
{
return
nil
,
err
}
witness
.
SignedAccumulator
=
sig
// attach previously selected reocation record to the witness for the client
nonrevAttr
=
witness
.
E
issrecord
:=
&
irma
.
IssuanceRecord
{
CredType
:
id
,
PKCounter
:
sk
.
Counter
,
Key
:
cred
.
RevocationKey
,
Attr
:
(
*
irma
.
RevocationAttribute
)(
nonrevAttr
),
Attr
:
(
*
irma
.
RevocationAttribute
)(
witness
.
E
),
Issued
:
time
.
Now
()
.
UnixNano
(),
// or (floored) cred issuance time?
ValidUntil
:
attributes
.
Expiry
()
.
UnixNano
(),
}
err
=
session
.
conf
.
IrmaConfiguration
.
Revocation
.
SaveIssuanceRecord
(
id
,
issrecord
,
sk
)
return
return
witness
,
session
.
conf
.
IrmaConfiguration
.
Revocation
.
SaveIssuanceRecord
(
id
,
issrecord
,
sk
)
}
func
(
s
*
Server
)
validateIssuanceRequest
(
request
*
irma
.
IssuanceRequest
)
error
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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