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,22 +178,44 @@ public class OpenPgpInputStream extends BufferedInputStream {
|
||||||
|
|
||||||
case PUBLIC_KEY_ENC_SESSION:
|
case PUBLIC_KEY_ENC_SESSION:
|
||||||
int pkeskVersion = bcpgIn.read();
|
int pkeskVersion = bcpgIn.read();
|
||||||
if (pkeskVersion <= 0 || pkeskVersion > 5) {
|
if (pkeskVersion <= 0 || pkeskVersion > 6) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip Key-ID
|
if (pkeskVersion == 3) {
|
||||||
for (int i = 0; i < 8; i++) {
|
// Skip Key-ID
|
||||||
bcpgIn.read();
|
for (int i = 0; i < 8; i++) {
|
||||||
}
|
bcpgIn.read();
|
||||||
|
}
|
||||||
|
|
||||||
int pkeskAlg = bcpgIn.read();
|
int pkeskAlg = bcpgIn.read();
|
||||||
if (PublicKeyAlgorithm.fromId(pkeskAlg) == null) {
|
if (PublicKeyAlgorithm.fromId(pkeskAlg) == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
containsOpenPgpPackets = true;
|
containsOpenPgpPackets = true;
|
||||||
isLikelyOpenPgpMessage = 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;
|
break;
|
||||||
|
|
||||||
case SIGNATURE:
|
case SIGNATURE:
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class MechanismNegotiationTest {
|
||||||
private final OpenPGPKeyVersion version;
|
private final OpenPGPKeyVersion version;
|
||||||
private final AlgorithmSuite preferences;
|
private final AlgorithmSuite preferences;
|
||||||
|
|
||||||
public KeySpecification(OpenPGPKeyVersion version,
|
KeySpecification(OpenPGPKeyVersion version,
|
||||||
AlgorithmSuite preferences) {
|
AlgorithmSuite preferences) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.preferences = preferences;
|
this.preferences = preferences;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue