mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-09 18:29:39 +02:00
Workaround for OpenPGPInputStream to recognize PKESKv6 packets
This commit is contained in:
parent
c2f7a8b2fd
commit
05ea7bd94f
2 changed files with 34 additions and 12 deletions
|
@ -178,10 +178,11 @@ 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;
|
||||
}
|
||||
|
||||
if (pkeskVersion == 3) {
|
||||
// Skip Key-ID
|
||||
for (int i = 0; i < 8; i++) {
|
||||
bcpgIn.read();
|
||||
|
@ -194,6 +195,27 @@ public class OpenPgpInputStream extends BufferedInputStream {
|
|||
|
||||
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:
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue