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
f1307f0b
Commit
f1307f0b
authored
May 18, 2021
by
Sietse Ringers
Browse files
feat: validate that keyshareserver has the appropriate IRMA private key installed
parent
5020b49e
Changes
2
Hide whitespace changes
Inline
Side-by-side
server/keyshare/keyshareserver/conf.go
View file @
f1307f0b
...
...
@@ -97,6 +97,10 @@ func processConfiguration(conf *Configuration) (*keysharecore.Core, error) {
if
conf
.
IrmaConfiguration
.
AttributeTypes
[
conf
.
KeyshareAttribute
]
==
nil
{
return
nil
,
server
.
LogError
(
errors
.
Errorf
(
"Unknown keyshare attribute: %s"
,
conf
.
KeyshareAttribute
))
}
_
,
err
=
conf
.
IrmaConfiguration
.
PrivateKeys
.
Latest
(
conf
.
KeyshareAttribute
.
CredentialTypeIdentifier
()
.
IssuerIdentifier
())
if
err
!=
nil
{
return
nil
,
server
.
LogError
(
errors
.
Errorf
(
"Failed to load private key of keyshare attribute: %v"
,
err
))
}
// Setup database
if
conf
.
DB
==
nil
{
...
...
server/keyshare/keyshareserver/conf_test.go
View file @
f1307f0b
...
...
@@ -14,8 +14,9 @@ func validConf(t *testing.T) *Configuration {
testdataPath
:=
test
.
FindTestdataFolder
(
t
)
return
&
Configuration
{
Configuration
:
&
server
.
Configuration
{
SchemesPath
:
filepath
.
Join
(
testdataPath
,
"irma_configuration"
),
Logger
:
irma
.
Logger
,
SchemesPath
:
filepath
.
Join
(
testdataPath
,
"irma_configuration"
),
IssuerPrivateKeysPath
:
filepath
.
Join
(
testdataPath
,
"privatekeys"
),
Logger
:
irma
.
Logger
,
},
DBType
:
DatabaseTypeMemory
,
JwtKeyID
:
0
,
...
...
@@ -65,4 +66,9 @@ func TestConfInvalidAESKey(t *testing.T) {
conf
.
KeyshareAttribute
=
irma
.
NewAttributeTypeIdentifier
(
"test.test.foo.bar"
)
_
,
err
=
New
(
conf
)
assert
.
Error
(
t
,
err
)
conf
=
validConf
(
t
)
conf
.
IssuerPrivateKeysPath
=
testdataPath
// no private keys here
_
,
err
=
New
(
conf
)
assert
.
Error
(
t
,
err
)
}
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