Skip to content

Commit 36f25c2

Browse files
author
gefeili
committed
#1744 Fix v4 skesk argon2 test vectors
1 parent 394e709 commit 36f25c2

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

pg/src/test/java/org/bouncycastle/openpgp/test/Argon2S2KTest.java

+11-16
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,12 @@
77
import java.io.OutputStream;
88
import java.security.SecureRandom;
99
import java.util.Date;
10-
import java.util.Iterator;
1110

1211
import org.bouncycastle.bcpg.ArmoredInputStream;
1312
import org.bouncycastle.bcpg.ArmoredOutputStream;
14-
import org.bouncycastle.bcpg.BCPGInputStream;
1513
import org.bouncycastle.bcpg.BCPGOutputStream;
16-
import org.bouncycastle.bcpg.HashAlgorithmTags;
1714
import org.bouncycastle.bcpg.S2K;
1815
import org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags;
19-
import org.bouncycastle.bcpg.SymmetricKeyEncSessionPacket;
20-
import org.bouncycastle.crypto.CryptoServicesRegistrar;
2116
import org.bouncycastle.openpgp.PGPEncryptedDataGenerator;
2217
import org.bouncycastle.openpgp.PGPEncryptedDataList;
2318
import org.bouncycastle.openpgp.PGPException;
@@ -42,7 +37,7 @@ public class Argon2S2KTest
4237

4338
static final String TEST_MSG_PASSWORD = "password";
4439

45-
// Test message from the crypto-refresh-05 document
40+
// https://www.rfc-editor.org/rfc/rfc9580.html#name-v4-skesk-using-argon2-with-
4641
static final String TEST_MSG_AES128 = "-----BEGIN PGP MESSAGE-----\n" +
4742
"Comment: Encrypted using AES with 128-bit key\n" +
4843
"Comment: Session key: 01FE16BBACFD1E7B78EF3B865187374F\n" +
@@ -53,7 +48,7 @@ public class Argon2S2KTest
5348
"=uIks\n" +
5449
"-----END PGP MESSAGE-----";
5550

56-
// Test message from the crypto-refresh-05 document
51+
// https://www.rfc-editor.org/rfc/rfc9580.html#name-v4-skesk-using-argon2-with-a
5752
private static final String TEST_MSG_AES192 = "-----BEGIN PGP MESSAGE-----\n" +
5853
"Comment: Encrypted using AES with 192-bit key\n" +
5954
"Comment: Session key: 27006DAE68E509022CE45A14E569E91001C2955AF8DFE194\n" +
@@ -64,16 +59,16 @@ public class Argon2S2KTest
6459
"=n8Ma\n" +
6560
"-----END PGP MESSAGE-----";
6661

67-
// Test message from the crypto-refresh-05 document
62+
// https://www.rfc-editor.org/rfc/rfc9580.html#name-v4-skesk-using-argon2-with-ae
6863
private static final String TEST_MSG_AES256 = "-----BEGIN PGP MESSAGE-----\n" +
69-
"Comment: Encrypted using AES with 192-bit key\n" +
70-
"Comment: Session key: 27006DAE68E509022CE45A14E569E91001C2955AF8DFE194\n" +
71-
"\n" +
72-
"wy8ECAThTKxHFTRZGKli3KNH4UP4AQQVhzLJ2va3FG8/pmpIPd/H/mdoVS5VBLLw\n" +
73-
"F9I+AdJ1Sw56PRYiKZjCvHg+2bnq02s33AJJoyBexBI4QKATFRkyez2gldJldRys\n" +
74-
"LVg77Mwwfgl2n/d572WciAM=\n" +
75-
"=n8Ma\n" +
76-
"-----END PGP MESSAGE-----";
64+
"Comment: Encrypted using AES with 256-bit key\n" +
65+
"Comment: Session key: BBEDA55B9AAE63DAC45D4F49D89DACF4AF37FEF...\n" +
66+
"Comment: Session key: ...C13BAB2F1F8E18FB74580D8B0\n" +
67+
"\n" +
68+
"wzcECQS4eJUgIG/3mcaILEJFpmJ8AQQVnZ9l7KtagdClm9UaQ/Z6M/5roklSGpGu\n" +
69+
"623YmaXezGj80j4B+Ku1sgTdJo87X1Wrup7l0wJypZls21Uwd67m9koF60eefH/K\n" +
70+
"95D1usliXOEm8ayQJQmZrjf6K6v9PWwqMQ==\n" +
71+
"-----END PGP MESSAGE-----";
7772

7873
static final String TEST_MSG_PLAIN = "Hello, world!";
7974

0 commit comments

Comments
 (0)