Skip to content
GitLab
Menu
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
993d43bf
Commit
993d43bf
authored
May 07, 2019
by
Sietse Ringers
Browse files
refactor: add JSON-LD @context in attribute-based signatures
parent
b1129984
Changes
4
Hide whitespace changes
Inline
Side-by-side
irma_signature.go
View file @
993d43bf
...
...
@@ -11,18 +11,25 @@ import (
"github.com/privacybydesign/gabi/big"
)
const
SignedMessageLDContext
=
"https://irma.app/ld/signature/v2"
// SignedMessage is a message signed with an attribute-based signature
// The 'realnonce' will be calculated as: SigRequest.GetNonce() = ASN1(nonce, SHA256(message), timestampSignature)
type
SignedMessage
struct
{
LDContext
string
`json:"@context"`
Signature
gabi
.
ProofList
`json:"signature"`
Indices
DisclosedAttributeIndices
`json:"indices"`
Nonce
*
big
.
Int
`json:"nonce"`
Context
*
big
.
Int
`json:"context"`
Message
string
`json:"message"`
Timestamp
*
atum
.
Timestamp
`json:"timestamp"`
}
// Message version. Current version is 2.
Version
int
`json:"v,omitempty"`
func
(
sm
*
SignedMessage
)
Version
()
int
{
if
sm
.
LDContext
==
""
{
return
1
}
return
2
}
func
(
sm
*
SignedMessage
)
GetNonce
()
*
big
.
Int
{
...
...
irmaclient/logs.go
View file @
993d43bf
...
...
@@ -20,10 +20,10 @@ type LogEntry struct {
request
irma
.
SessionRequest
// cached parsed version of Request; get with LogEntry.SessionRequest()
// Session type-specific info
Removed
map
[
irma
.
CredentialTypeIdentifier
][]
irma
.
TranslatedString
`json:",omitempty"`
// In case of credential removal
SignedMessage
[]
byte
`json:",omitempty"`
// In case of signature sessions
Timestamp
*
atum
.
Timestamp
`json:",omitempty"`
// In case of signature sessions
Sign
atureVersion
int
`json:",omitempty"`
// In case of signature sessions
Removed
map
[
irma
.
CredentialTypeIdentifier
][]
irma
.
TranslatedString
`json:",omitempty"`
// In case of credential removal
SignedMessage
[]
byte
`json:",omitempty"`
// In case of signature sessions
Timestamp
*
atum
.
Timestamp
`json:",omitempty"`
// In case of signature sessions
Sign
edMessageLDContext
string
`json:",omitempty"`
// In case of signature sessions
IssueCommitment
*
irma
.
IssueCommitmentMessage
`json:",omitempty"`
Disclosure
*
irma
.
Disclosure
`json:",omitempty"`
...
...
@@ -106,12 +106,12 @@ func (entry *LogEntry) GetSignedMessage() (abs *irma.SignedMessage, err error) {
}
sigrequest
:=
request
.
(
*
irma
.
SignatureRequest
)
return
&
irma
.
SignedMessage
{
LDContext
:
entry
.
SignedMessageLDContext
,
Signature
:
entry
.
Disclosure
.
Proofs
,
Nonce
:
sigrequest
.
Nonce
,
Context
:
sigrequest
.
Context
,
Message
:
string
(
entry
.
SignedMessage
),
Timestamp
:
entry
.
Timestamp
,
Version
:
entry
.
SignatureVersion
,
},
nil
}
...
...
@@ -135,7 +135,7 @@ func (session *session) createLogEntry(response interface{}) (*LogEntry, error)
request
:=
session
.
request
.
(
*
irma
.
SignatureRequest
)
entry
.
SignedMessage
=
[]
byte
(
request
.
Message
)
entry
.
Timestamp
=
request
.
Timestamp
entry
.
Sign
atureVersion
=
2
entry
.
Sign
edMessageLDContext
=
irma
.
SignedMessageLDContext
fallthrough
case
irma
.
ActionDisclosing
:
...
...
requests.go
View file @
993d43bf
...
...
@@ -433,13 +433,13 @@ func (sr *SignatureRequest) SignatureFromMessage(message interface{}) (*SignedMe
}
return
&
SignedMessage
{
LDContext
:
SignedMessageLDContext
,
Signature
:
signature
.
Proofs
,
Indices
:
signature
.
Indices
,
Nonce
:
sr
.
Nonce
,
Context
:
sr
.
Context
,
Message
:
sr
.
Message
,
Timestamp
:
sr
.
Timestamp
,
Version
:
2
,
},
nil
}
...
...
timestamp.go
View file @
993d43bf
...
...
@@ -114,7 +114,7 @@ func (sm *SignedMessage) VerifyTimestamp(message string, conf *Configuration) er
}
}
bts
,
err
:=
TimestampRequest
(
message
,
sigs
,
disclosed
,
sm
.
Version
>=
2
,
conf
)
bts
,
err
:=
TimestampRequest
(
message
,
sigs
,
disclosed
,
sm
.
Version
()
>=
2
,
conf
)
if
err
!=
nil
{
return
err
}
...
...
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