@Test
public void testGetX509CertificateFromPgpKeyPair() throws Exception
{

    Date today = new Date();
    PGPPublicKey pgpPublicKey = PGPEncryptionUtil.findPublicKeyById( findFile( PUBLIC_KEYRING ), PUBLIC_KEY_ID );
    PGPSecretKey pgpSecretKey = PGPEncryptionUtil.findSecretKeyById( findFile( SECRET_KEYRING ), SECRET_KEY_ID );
    X509Certificate x509Certificate = PGPEncryptionUtil
            .getX509CertificateFromPgpKeyPair( pgpPublicKey, pgpSecretKey, SECRET_PWD,
                    "C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc,"
                            + " OU=Certification Services Division,"
                            + " CN=Thawte Server CA/emailAddress=server-certs@thawte.com",
                    "C=US, ST=Maryland, L=Pasadena, O=Brent Baccala,"
                            + "OU=FreeSoft, CN=www.freesoft.org/emailAddress=baccala@freesoft.org",
                    today, new Date( today.getTime() + ( 1000 * 60 * 60 * 24 ) ), new BigInteger( "1" ) );
    assertNotNull( x509Certificate );
    JcaPGPKeyConverter c = new JcaPGPKeyConverter();
    PublicKey publicKey = c.getPublicKey( pgpSecretKey.getPublicKey() );
    x509Certificate.verify( publicKey, new BouncyCastleProvider() );
}