PGPSignatureUtil { public static PGPPublicKey mergeSignatures( PGPPublicKey targetKey, PGPPublicKey sourceKey ) throws PGPException { if ( !Objects.deepEquals( targetKey.getFingerprint(), sourceKey.getFingerprint() ) ) { throw new IllegalArgumentException( "Signature merge can be done for different instances of the same public key only" ); } return copySignatures( targetKey, sourceKey ); } private  PGPSignatureUtil(); static boolean isSignedBy( PGPPublicKey pubKey, PGPPublicKey signerPubKey ); static Map<Long, PGPSignature> getSignatures( PGPPublicKey pubKey ); static PGPPublicKey mergeSignatures( PGPPublicKey targetKey, PGPPublicKey sourceKey );  }
@Test( expected = IllegalArgumentException.class ) public void testMergeSignatures_withDifferentPubKeys() throws Exception { PGPPublicKey alicePuKey = PGPTestDataFactory.getPublicKey( "alice" ); PGPPublicKey applePubKey = PGPTestDataFactory.getPublicKey( "apple" ); PGPSignatureUtil.mergeSignatures( alicePuKey, applePubKey ); }