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
cce18c8d
Commit
cce18c8d
authored
Sep 28, 2017
by
Sietse Ringers
Browse files
ParseAndroidStorage correctly parses distributed credentials
parent
faf6a34e
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
irmago_test.go
View file @
cce18c8d
...
...
@@ -68,6 +68,11 @@ func verifyManagerIsUnmarshaled(t *testing.T) {
assert
.
NotNil
(
t
,
cred
,
"Credential should exist"
)
assert
.
NotNil
(
t
,
cred
.
Attributes
[
0
],
"Metadata attribute of irma-demo.RU.studentCard should not be nil"
)
cred
,
err
=
Manager
.
credential
(
NewCredentialTypeIdentifier
(
"test.test.mijnirma"
),
0
)
assert
.
NoError
(
t
,
err
,
"could not fetch credential"
)
assert
.
NotNil
(
t
,
cred
,
"Credential should exist"
)
assert
.
NotNil
(
t
,
cred
.
Signature
.
KeyshareP
)
assert
.
NotEmpty
(
t
,
Manager
.
CredentialInfoList
())
assert
.
True
(
t
,
...
...
storage.go
View file @
cce18c8d
...
...
@@ -109,7 +109,12 @@ func (cm *CredentialManager) ParseAndroidStorage() (err error) {
}{}
xml
.
Unmarshal
(
bytes
,
&
parsedxml
)
parsedjson
:=
make
(
map
[
string
][]
*
gabi
.
Credential
)
parsedjson
:=
make
(
map
[
string
][]
*
struct
{
Signature
*
gabi
.
CLSignature
`json:"signature"`
Pk
*
gabi
.
PublicKey
`json:"-"`
Attributes
[]
*
big
.
Int
`json:"attributes"`
SharedPoints
[]
*
big
.
Int
`json:"public_sks"`
})
cm
.
keyshareServers
=
make
(
map
[
SchemeManagerIdentifier
]
*
keyshareServer
)
for
_
,
xmltag
:=
range
parsedxml
.
Strings
{
if
xmltag
.
Name
==
"credentials"
{
...
...
@@ -136,7 +141,14 @@ func (cm *CredentialManager) ParseAndroidStorage() (err error) {
for
_
,
list
:=
range
parsedjson
{
cm
.
secretkey
=
list
[
0
]
.
Attributes
[
0
]
for
_
,
gabicred
:=
range
list
{
for
_
,
oldcred
:=
range
list
{
gabicred
:=
&
gabi
.
Credential
{
Attributes
:
oldcred
.
Attributes
,
Signature
:
oldcred
.
Signature
,
}
if
oldcred
.
SharedPoints
!=
nil
&&
len
(
oldcred
.
SharedPoints
)
>
0
{
gabicred
.
Signature
.
KeyshareP
=
oldcred
.
SharedPoints
[
0
]
}
cred
:=
newCredential
(
gabicred
)
if
cred
.
CredentialType
()
==
nil
{
return
errors
.
New
(
"cannot add unknown credential type"
)
...
...
testdata/storage/cardemu.xml
View file @
cce18c8d
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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