1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-09 10:19:39 +02:00

Workaround for OpenPGPInputStream to recognize PKESKv6 packets

This commit is contained in:
Paul Schaub 2025-05-05 14:19:32 +02:00
parent c2f7a8b2fd
commit 05ea7bd94f
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 34 additions and 12 deletions

View file

@ -178,22 +178,44 @@ public class OpenPgpInputStream extends BufferedInputStream {
case PUBLIC_KEY_ENC_SESSION:
int pkeskVersion = bcpgIn.read();
if (pkeskVersion <= 0 || pkeskVersion > 5) {
if (pkeskVersion <= 0 || pkeskVersion > 6) {
return;
}
// Skip Key-ID
for (int i = 0; i < 8; i++) {
bcpgIn.read();
}
if (pkeskVersion == 3) {
// Skip Key-ID
for (int i = 0; i < 8; i++) {
bcpgIn.read();
}
int pkeskAlg = bcpgIn.read();
if (PublicKeyAlgorithm.fromId(pkeskAlg) == null) {
return;
}
int pkeskAlg = bcpgIn.read();
if (PublicKeyAlgorithm.fromId(pkeskAlg) == null) {
return;
}
containsOpenPgpPackets = true;
isLikelyOpenPgpMessage = true;
containsOpenPgpPackets = true;
isLikelyOpenPgpMessage = true;
} else if (pkeskVersion == 6) {
int len = bcpgIn.read();
if (len != 0) {
int ver = bcpgIn.read();
if (ver == 4) {
for (int i = 0; i < 20; i++) {
bcpgIn.read();
}
} else {
for (int i = 0; i < 32; i++) {
bcpgIn.read();
}
}
int pkeskAlg = bcpgIn.read();
if (PublicKeyAlgorithm.fromId(pkeskAlg) == null) {
return;
}
}
containsOpenPgpPackets = true;
isLikelyOpenPgpMessage = true;
}
break;
case SIGNATURE:

View file

@ -146,7 +146,7 @@ public class MechanismNegotiationTest {
private final OpenPGPKeyVersion version;
private final AlgorithmSuite preferences;
public KeySpecification(OpenPGPKeyVersion version,
KeySpecification(OpenPGPKeyVersion version,
AlgorithmSuite preferences) {
this.version = version;
this.preferences = preferences;