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