Skip to content

Commit

Permalink
PGPSecretKey: Do not append checksum for unencrypted v6 keys
Browse files Browse the repository at this point in the history
  • Loading branch information
vanitasvitae committed Jul 2, 2024
1 parent 190aaa5 commit cea6a81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pg/src/main/java/org/bouncycastle/openpgp/PGPSecretKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ private static SecretKeyPacket buildSecretKeyPacket(boolean isMasterKey, PGPPriv

return generateSecretKeyPacket(isMasterKey, pubKey.publicPk, encAlgorithm, s2kUsage, s2k, iv, encData);
}
else
else if (pubKey.getVersion() != PublicKeyPacket.VERSION_6)
{
pOut.write(checksum(null, keyData, keyData.length));
return generateSecretKeyPacket(isMasterKey, pubKey.publicPk, encAlgorithm, bOut.toByteArray());
}
return generateSecretKeyPacket(isMasterKey, pubKey.publicPk, encAlgorithm, bOut.toByteArray());
}
catch (PGPException e)
{
Expand Down

0 comments on commit cea6a81

Please sign in to comment.