Skip to content

Commit f310da4

Browse files
committed
Properly encode anonymous PKESKv6 packets
1 parent 6468b33 commit f310da4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pg/src/main/java/org/bouncycastle/bcpg/PublicKeyEncSessionPacket.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,16 @@ public void encode(
276276
}
277277
else if (version == VERSION_6)
278278
{
279-
pOut.write(keyFingerprint.length + 1);
280-
pOut.write(keyVersion);
281-
pOut.write(keyFingerprint);
279+
if (keyFingerprint.length != 0)
280+
{
281+
pOut.write(keyFingerprint.length + 1);
282+
pOut.write(keyVersion);
283+
pOut.write(keyFingerprint);
284+
}
285+
else
286+
{
287+
pOut.write(0);
288+
}
282289
}
283290

284291
pOut.write(algorithm);

0 commit comments

Comments
 (0)