@Test
public void testKeySigning() throws PGPException, IOException
{

    KeyPair first = PGPEncryptionUtil.generateKeyPair( "first@key.com", "first", false );
    KeyPair second = PGPEncryptionUtil.generateKeyPair( "second@key.com", "second", false );
    signKeyAndPrintIds( first, second, "second" );
    InputStream firstPublicStream = new ByteArrayInputStream( first.getPubKeyring() );
    InputStream secondPublicStream = new ByteArrayInputStream( second.getPubKeyring() );
    PGPPublicKeyRingCollection firstPublicKeyRingCollection =
            new PGPPublicKeyRingCollection( PGPUtil.getDecoderStream( firstPublicStream ),
                    new JcaKeyFingerprintCalculator() );
    PGPPublicKeyRingCollection secondPublicKeyRingCollection =
            new PGPPublicKeyRingCollection( PGPUtil.getDecoderStream( secondPublicStream ),
                    new JcaKeyFingerprintCalculator() );
    if ( firstPublicKeyRingCollection.getKeyRings().hasNext() )
    {
        PGPPublicKeyRing firstPublicKeyRing = null;
        PGPPublicKeyRing secondPublicKeyRing = null;
        firstPublicKeyRing = firstPublicKeyRingCollection.getKeyRings().next();
        secondPublicKeyRing = secondPublicKeyRingCollection.getKeyRings().next();
        assertEquals( true,
                printPublicKeySignatures( firstPublicKeyRing.getPublicKey(), secondPublicKeyRing.getPublicKey() ) );
    }
}