// re-encrypt the key with an empty password
pgpPriv = PGPSecretKeyRing.removeSecretKey(pgpPriv, pgpKey);
pgpKey = PGPSecretKey.copyWithNewPassword(
pgpKey,
new BcPBESecretKeyDecryptorBuilder(new BcPGPDigestCalculatorProvider()).build(rewrapPass),
null);
pgpPriv = PGPSecretKeyRing.insertSecretKey(pgpPriv, pgpKey);
// this should succeed
PGPPrivateKey privTmp = pgpKey.extractPrivateKey(null);