Avoid catch/rethrow
@@ -1212,13 +1212,13 @@ static void verifyCertificateVerify(TlsContext context, CertificateRequest certi
short certificateType, DigitallySigned certificateVerify, TlsHandshakeHash handshakeHash) throws IOException
{
// Verify the CertificateVerify message contains a correct signature.
+ boolean verified;
try
{
TlsVerifier verifier = certificate.getCertificateAt(0)
.createVerifier(getSignatureAlgorithmClient(certificateType));
TlsStreamVerifier streamVerifier = verifier.getStreamVerifier(certificateVerify);
- boolean verified;
if (streamVerifier != null)
{
handshakeHash.copyBufferTo(streamVerifier.getOutputStream());
@@ -1241,11 +1241,6 @@ static void verifyCertificateVerify(TlsContext context, CertificateRequest certi
verified = verifier.verifyRawSignature(certificateVerify, hash);
}
-
- if (!verified)
- {
- throw new TlsFatalAlert(AlertDescription.decrypt_error);
- }
}
catch (TlsFatalAlert e)
{
@@ -1255,6 +1250,11 @@ static void verifyCertificateVerify(TlsContext context, CertificateRequest certi
{
throw new TlsFatalAlert(AlertDescription.decrypt_error, e);
}
+
+ if (!verified)
+ {
+ throw new TlsFatalAlert(AlertDescription.decrypt_error);
+ }
}
static DigitallySigned generateServerKeyExchangeSignature(TlsContext context, TlsCredentialedSigner credentials,
