Skip to content

Commit

Permalink
PGPSignature: Use proper method to update signature with salt
Browse files Browse the repository at this point in the history
CANONICAL_TEXT signatures update() would handle 'd0' specially,
resulting in broken signature verification if salt contained 'd0'.
With this patch, we push salt to sigOut directly.
  • Loading branch information
vanitasvitae committed Jul 9, 2024
1 parent 2b97d68 commit 82d73b8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pg/src/main/java/org/bouncycastle/openpgp/PGPSignature.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,18 @@ private void checkSaltSize()
}

private void updateWithSalt()
throws PGPException
{
if (getVersion() == SignaturePacket.VERSION_6)
{
update(sigPck.getSalt());
try
{
sigOut.write(sigPck.getSalt());
}
catch (IOException e)
{
throw new PGPException("Cannot update signature with salt.", e);
}
}
}

Expand Down

0 comments on commit 82d73b8

Please sign in to comment.