#266 Handle ClassCastException in signature.init calls

This commit is contained in:
Péter Barabás 2022-04-05 10:38:19 +02:00 committed by Paul Schaub
parent f6c6b9aded
commit 8c6813ce56
1 changed files with 5 additions and 5 deletions

View File

@ -461,7 +461,7 @@ public abstract class SignatureValidator {
if (!valid) { if (!valid) {
throw new SignatureValidationException("Signature is not correct."); throw new SignatureValidationException("Signature is not correct.");
} }
} catch (PGPException e) { } catch (PGPException | ClassCastException e) {
throw new SignatureValidationException("Cannot verify subkey binding signature correctness", e); throw new SignatureValidationException("Cannot verify subkey binding signature correctness", e);
} }
} }
@ -485,7 +485,7 @@ public abstract class SignatureValidator {
if (!valid) { if (!valid) {
throw new SignatureValidationException("Primary Key Binding Signature is not correct."); throw new SignatureValidationException("Primary Key Binding Signature is not correct.");
} }
} catch (PGPException e) { } catch (PGPException | ClassCastException e) {
throw new SignatureValidationException("Cannot verify primary key binding signature correctness", e); throw new SignatureValidationException("Cannot verify primary key binding signature correctness", e);
} }
} }
@ -514,7 +514,7 @@ public abstract class SignatureValidator {
if (!valid) { if (!valid) {
throw new SignatureValidationException("Signature is not correct."); throw new SignatureValidationException("Signature is not correct.");
} }
} catch (PGPException e) { } catch (PGPException | ClassCastException e) {
throw new SignatureValidationException("Cannot verify direct-key signature correctness", e); throw new SignatureValidationException("Cannot verify direct-key signature correctness", e);
} }
} }
@ -577,7 +577,7 @@ public abstract class SignatureValidator {
if (!valid) { if (!valid) {
throw new SignatureValidationException("Signature over user-id '" + userId + "' is not correct."); throw new SignatureValidationException("Signature over user-id '" + userId + "' is not correct.");
} }
} catch (PGPException e) { } catch (PGPException | ClassCastException e) {
throw new SignatureValidationException("Cannot verify signature over user-id '" + userId + "'.", e); throw new SignatureValidationException("Cannot verify signature over user-id '" + userId + "'.", e);
} }
} }
@ -602,7 +602,7 @@ public abstract class SignatureValidator {
if (!valid) { if (!valid) {
throw new SignatureValidationException("Signature over user-attribute vector is not correct."); throw new SignatureValidationException("Signature over user-attribute vector is not correct.");
} }
} catch (PGPException e) { } catch (PGPException | ClassCastException e) {
throw new SignatureValidationException("Cannot verify signature over user-attribute vector.", e); throw new SignatureValidationException("Cannot verify signature over user-attribute vector.", e);
} }
} }