/** * Verify this signature for a {@link SubKey} signed by a {@link MasterKey}. * * @param key a subkey * @param masterKey the signing master key * @return {@code true} if the signature is valid, {@code false} otherwise */ public boolean verifyCertification(SubKey key, MasterKey masterKey) { try { signature.initVerify(masterKey.getPublicKey(), "BC"); return signature.verifyCertification(masterKey.getPublicKey(), key.getPublicKey()); } catch (Exception e) { return false; } }
/** * Verify this signature for a self-signed {@link MasterKey}. * * @param key a self-signed master key * @return {@code true} if the signature is valid, {@code false} otherwise */ public boolean verifyCertification(MasterKey key) { try { signature.initVerify(key.getPublicKey(), "BC"); return signature.verifyCertification(key.getUserID(), key.getPublicKey()); } catch (PGPException e) { return false; } catch (SignatureException e) { return false; } catch (Exception e) { throw new RuntimeException(e); } }