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
2c9ff51c
Commit
2c9ff51c
authored
Feb 11, 2019
by
Sietse Ringers
Browse files
Add missing error checks
parent
62966ab9
Changes
6
Hide whitespace changes
Inline
Side-by-side
internal/fs/fs.go
View file @
2c9ff51c
...
@@ -179,7 +179,6 @@ func Base64Decode(b []byte) ([]byte, error) {
...
@@ -179,7 +179,6 @@ func Base64Decode(b []byte) ([]byte, error) {
encodings
=
[]
*
base64
.
Encoding
{
base64
.
RawStdEncoding
,
base64
.
URLEncoding
,
base64
.
RawURLEncoding
,
base64
.
StdEncoding
}
encodings
=
[]
*
base64
.
Encoding
{
base64
.
RawStdEncoding
,
base64
.
URLEncoding
,
base64
.
RawURLEncoding
,
base64
.
StdEncoding
}
)
)
for
_
,
encoding
:=
range
encodings
{
for
_
,
encoding
:=
range
encodings
{
err
=
nil
if
bts
,
err
=
encoding
.
DecodeString
(
string
(
b
));
err
==
nil
{
if
bts
,
err
=
encoding
.
DecodeString
(
string
(
b
));
err
==
nil
{
break
break
}
}
...
...
internal/sessiontest/main_test.go
View file @
2c9ff51c
...
@@ -188,18 +188,20 @@ func getJwt(t *testing.T, request irma.SessionRequest, sessiontype string, alg j
...
@@ -188,18 +188,20 @@ func getJwt(t *testing.T, request irma.SessionRequest, sessiontype string, alg j
tok
:=
jwt
.
NewWithClaims
(
jwt
.
SigningMethodRS256
,
jwtcontents
)
tok
:=
jwt
.
NewWithClaims
(
jwt
.
SigningMethodRS256
,
jwtcontents
)
tok
.
Header
[
"kid"
]
=
"requestor1"
tok
.
Header
[
"kid"
]
=
"requestor1"
j
,
err
=
tok
.
SignedString
(
sk
)
j
,
err
=
tok
.
SignedString
(
sk
)
require
.
NoError
(
t
,
err
)
case
jwt
.
SigningMethodHS256
:
case
jwt
.
SigningMethodHS256
:
tok
:=
jwt
.
NewWithClaims
(
jwt
.
SigningMethodHS256
,
jwtcontents
)
tok
:=
jwt
.
NewWithClaims
(
jwt
.
SigningMethodHS256
,
jwtcontents
)
tok
.
Header
[
"kid"
]
=
"requestor3"
tok
.
Header
[
"kid"
]
=
"requestor3"
bts
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
JwtServerConfiguration
.
Requestors
[
"requestor3"
]
.
AuthenticationKey
)
bts
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
JwtServerConfiguration
.
Requestors
[
"requestor3"
]
.
AuthenticationKey
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
j
,
err
=
tok
.
SignedString
(
bts
)
j
,
err
=
tok
.
SignedString
(
bts
)
require
.
NoError
(
t
,
err
)
case
jwt
.
SigningMethodNone
:
case
jwt
.
SigningMethodNone
:
tok
:=
jwt
.
NewWithClaims
(
jwt
.
SigningMethodNone
,
jwtcontents
)
tok
:=
jwt
.
NewWithClaims
(
jwt
.
SigningMethodNone
,
jwtcontents
)
tok
.
Header
[
"kid"
]
=
kid
tok
.
Header
[
"kid"
]
=
kid
j
,
err
=
tok
.
SignedString
(
jwt
.
UnsafeAllowNoneSignatureType
)
j
,
err
=
tok
.
SignedString
(
jwt
.
UnsafeAllowNoneSignatureType
)
require
.
NoError
(
t
,
err
)
}
}
require
.
NoError
(
t
,
err
)
return
j
return
j
}
}
...
...
irma/cmd/session.go
View file @
2c9ff51c
...
@@ -153,7 +153,8 @@ func postRequest(serverurl string, request irma.RequestorRequest, name, authmeth
...
@@ -153,7 +153,8 @@ func postRequest(serverurl string, request irma.RequestorRequest, name, authmeth
transport
.
SetHeader
(
"Authentication"
,
key
)
transport
.
SetHeader
(
"Authentication"
,
key
)
err
=
transport
.
Post
(
"session"
,
qr
,
request
)
err
=
transport
.
Post
(
"session"
,
qr
,
request
)
case
"hmac"
,
"rsa"
:
case
"hmac"
,
"rsa"
:
jwtstr
,
err
:=
signRequest
(
request
,
name
,
authmethod
,
key
)
var
jwtstr
string
jwtstr
,
err
=
signRequest
(
request
,
name
,
authmethod
,
key
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
...
...
irma/cmd/sign.go
View file @
2c9ff51c
...
@@ -44,9 +44,9 @@ Careful: this command could fail and invalidate or destroy your scheme manager d
...
@@ -44,9 +44,9 @@ Careful: this command could fail and invalidate or destroy your scheme manager d
case
2
:
case
2
:
sk
=
args
[
0
]
sk
=
args
[
0
]
confpath
,
err
=
filepath
.
Abs
(
args
[
1
])
confpath
,
err
=
filepath
.
Abs
(
args
[
1
])
if
err
!=
nil
{
}
return
errors
.
WrapPrefix
(
err
,
"Invalid path"
,
0
)
if
err
!=
nil
{
}
return
errors
.
WrapPrefix
(
err
,
"Invalid path"
,
0
)
}
}
privatekey
,
err
:=
readPrivateKey
(
sk
)
privatekey
,
err
:=
readPrivateKey
(
sk
)
...
...
irma/cmd/update.go
View file @
2c9ff51c
...
@@ -52,6 +52,9 @@ func updateSchemeManager(paths []string) error {
...
@@ -52,6 +52,9 @@ func updateSchemeManager(paths []string) error {
for
_
,
path
:=
range
paths
{
for
_
,
path
:=
range
paths
{
path
,
err
:=
filepath
.
Abs
(
path
)
path
,
err
:=
filepath
.
Abs
(
path
)
if
err
!=
nil
{
return
err
}
irmaconf
,
manager
:=
filepath
.
Dir
(
path
),
filepath
.
Base
(
path
)
irmaconf
,
manager
:=
filepath
.
Dir
(
path
),
filepath
.
Base
(
path
)
conf
,
err
:=
irma
.
NewConfiguration
(
irmaconf
)
conf
,
err
:=
irma
.
NewConfiguration
(
irmaconf
)
...
...
irmaconfig.go
View file @
2c9ff51c
...
@@ -1355,6 +1355,9 @@ func (conf *Configuration) CheckKeys() error {
...
@@ -1355,6 +1355,9 @@ func (conf *Configuration) CheckKeys() error {
continue
continue
}
}
latest
,
err
:=
conf
.
PublicKey
(
issuerid
,
indices
[
len
(
indices
)
-
1
])
latest
,
err
:=
conf
.
PublicKey
(
issuerid
,
indices
[
len
(
indices
)
-
1
])
if
err
!=
nil
{
return
err
}
now
:=
time
.
Now
()
.
Unix
()
now
:=
time
.
Now
()
.
Unix
()
if
latest
==
nil
||
latest
.
ExpiryDate
<
now
{
if
latest
==
nil
||
latest
.
ExpiryDate
<
now
{
conf
.
Warnings
=
append
(
conf
.
Warnings
,
fmt
.
Sprintf
(
"Issuer %s has no nonexpired public keys"
,
issuerid
.
String
()))
conf
.
Warnings
=
append
(
conf
.
Warnings
,
fmt
.
Sprintf
(
"Issuer %s has no nonexpired public keys"
,
issuerid
.
String
()))
...
...
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