Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
41760e4b
Commit
41760e4b
authored
4 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
ocsp response: improve exception message
parent
9ca0de25
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/crypto.cpp
+17
-2
17 additions, 2 deletions
src/crypto.cpp
with
17 additions
and
2 deletions
src/crypto.cpp
+
17
−
2
View file @
41760e4b
...
...
@@ -1392,8 +1392,23 @@ OcspResponse::verifyDirect(const Certificate& crt, const Blob& nonce)
ret
=
gnutls_ocsp_resp_verify_direct
(
response
,
crt
.
issuer
->
cert
,
&
verify
,
0
);
if
(
ret
<
0
)
throw
CryptoException
(
gnutls_strerror
(
ret
));
if
(
verify
!=
0
)
throw
CryptoException
(
"Error verifying response signature "
+
std
::
to_string
(
verify
));
if
(
verify
)
{
if
(
verify
&
GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND
)
throw
CryptoException
(
"Signer cert not found"
);
if
(
verify
&
GNUTLS_OCSP_VERIFY_SIGNER_KEYUSAGE_ERROR
)
throw
CryptoException
(
"Signer cert keyusage error"
);
if
(
verify
&
GNUTLS_OCSP_VERIFY_UNTRUSTED_SIGNER
)
throw
CryptoException
(
"Signer cert is not trusted"
);
if
(
verify
&
GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM
)
throw
CryptoException
(
"Insecure algorithm"
);
if
(
verify
&
GNUTLS_OCSP_VERIFY_SIGNATURE_FAILURE
)
throw
CryptoException
(
"Signature failure"
);
if
(
verify
&
GNUTLS_OCSP_VERIFY_CERT_NOT_ACTIVATED
)
throw
CryptoException
(
"Signer cert not yet activated"
);
if
(
verify
&
GNUTLS_OCSP_VERIFY_CERT_EXPIRED
)
throw
CryptoException
(
"Signer cert expired"
);
throw
CryptoException
(
gnutls_strerror
(
GNUTLS_E_OCSP_RESPONSE_ERROR
));
}
// Check whether the OCSP response is about the provided certificate.
if
((
ret
=
gnutls_ocsp_resp_check_crt
(
response
,
0
,
crt
.
cert
))
<
0
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment