|
11 | 11 | import java.util.Date;
|
12 | 12 | import java.util.Iterator;
|
13 | 13 |
|
14 |
| -import org.bouncycastle.bcpg.*; |
| 14 | +import org.bouncycastle.bcpg.ArmoredInputStream; |
| 15 | +import org.bouncycastle.bcpg.BCPGInputStream; |
| 16 | +import org.bouncycastle.bcpg.CompressionAlgorithmTags; |
| 17 | +import org.bouncycastle.bcpg.HashAlgorithmTags; |
| 18 | +import org.bouncycastle.bcpg.PublicKeyAlgorithmTags; |
| 19 | +import org.bouncycastle.bcpg.SignatureSubpacket; |
| 20 | +import org.bouncycastle.bcpg.SignatureSubpacketInputStream; |
| 21 | +import org.bouncycastle.bcpg.SignatureSubpacketTags; |
| 22 | +import org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags; |
15 | 23 | import org.bouncycastle.bcpg.sig.IntendedRecipientFingerprint;
|
16 | 24 | import org.bouncycastle.bcpg.sig.IssuerFingerprint;
|
17 | 25 | import org.bouncycastle.bcpg.sig.KeyFlags;
|
18 | 26 | import org.bouncycastle.bcpg.sig.NotationData;
|
19 | 27 | import org.bouncycastle.bcpg.sig.SignatureTarget;
|
20 | 28 | import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
| 29 | +import org.bouncycastle.math.ec.rfc8032.Ed25519; |
21 | 30 | import org.bouncycastle.openpgp.PGPException;
|
22 | 31 | import org.bouncycastle.openpgp.PGPLiteralData;
|
23 | 32 | import org.bouncycastle.openpgp.PGPLiteralDataGenerator;
|
@@ -759,6 +768,7 @@ public void performTest()
|
759 | 768 | testUserAttributeEncoding();
|
760 | 769 | testExportNonExportableSignature();
|
761 | 770 | testRejectionOfIllegalSignatureType0xFF();
|
| 771 | + testGetSignatureOfLegacyEd25519KeyWithShortMPIs(); |
762 | 772 | }
|
763 | 773 |
|
764 | 774 | private void testUserAttributeEncoding()
|
@@ -1413,6 +1423,17 @@ private void testRejectionOfIllegalSignatureType0xFF()
|
1413 | 1423 | }
|
1414 | 1424 | }
|
1415 | 1425 |
|
| 1426 | + private void testGetSignatureOfLegacyEd25519KeyWithShortMPIs() |
| 1427 | + throws PGPException, IOException |
| 1428 | + { |
| 1429 | + String ed25519KeyWithShortSignatureMPIs = "88740401160a00270502666a2d4009105ac5b83f1a5ad687162104229cfc85fe0ca2e3718b022c5ac5b83f1a5ad6870000a16b00f7754c1d14b068ae5e6816c376367569b1ae984587e8e5ec3cc54b811549a4920100ca2159e5965bf7d8655385449994aead14ccf05c3f33335b98d305c0f20ef50e"; |
| 1430 | + ByteArrayInputStream bIn = new ByteArrayInputStream(Hex.decode(ed25519KeyWithShortSignatureMPIs)); |
| 1431 | + BCPGInputStream pIn = new BCPGInputStream(bIn); |
| 1432 | + PGPSignature signature = new PGPSignature(pIn); |
| 1433 | + isEquals("Short MPIs in LegacyEd25519 signature MUST be properly parsed", |
| 1434 | + Ed25519.SIGNATURE_SIZE, signature.getSignature().length); |
| 1435 | + } |
| 1436 | + |
1416 | 1437 | private PGPSignatureList readSignatures(String armored)
|
1417 | 1438 | throws IOException
|
1418 | 1439 | {
|
|
0 commit comments