|
3 | 3 | import java.io.BufferedReader;
|
4 | 4 | import java.io.InputStream;
|
5 | 5 | import java.io.InputStreamReader;
|
| 6 | +import java.math.BigInteger; |
6 | 7 | import java.util.ArrayList;
|
7 | 8 | import java.util.HashMap;
|
8 | 9 | import java.util.List;
|
|
11 | 12 |
|
12 | 13 | import junit.framework.TestCase;
|
13 | 14 | import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
|
| 15 | +import org.bouncycastle.crypto.params.ECPrivateKeyParameters; |
14 | 16 | import org.bouncycastle.mls.TreeKEM.TreeKEMPublicKey;
|
15 | 17 | import org.bouncycastle.mls.codec.MLSInputStream;
|
16 | 18 | import org.bouncycastle.mls.codec.MLSMessage;
|
|
20 | 22 | import org.bouncycastle.mls.protocol.Group;
|
21 | 23 | import org.bouncycastle.test.TestResourceFinder;
|
22 | 24 | import org.bouncycastle.util.Arrays;
|
| 25 | +import org.bouncycastle.util.BigIntegers; |
23 | 26 | import org.bouncycastle.util.encoders.Hex;
|
24 | 27 |
|
25 | 28 | public class ClientVectorTest
|
@@ -134,6 +137,14 @@ public Epoch(List<byte[]> proposals, byte[] commit, byte[] epoch_authenticator)
|
134 | 137 | }
|
135 | 138 |
|
136 | 139 | MlsCipherSuite suite = MlsCipherSuite.getSuite(cipherSuite);
|
| 140 | + |
| 141 | + if(cipherSuite == MlsCipherSuite.MLS_256_DHKEMP521_AES256GCM_SHA512_P521) |
| 142 | + { |
| 143 | + //Converts encoded HPKE private key for P521 to comply with length constraints |
| 144 | + encryption_priv = BigIntegers.asUnsignedByteArray(66, new BigInteger(1, encryption_priv)); |
| 145 | + init_priv = BigIntegers.asUnsignedByteArray(66, new BigInteger(1, init_priv)); |
| 146 | + } |
| 147 | + |
137 | 148 | AsymmetricCipherKeyPair leafKeyPair = suite.getHPKE().deserializePrivateKey(encryption_priv, null);
|
138 | 149 | Map<Secret, byte[]> externalPsks = new HashMap<Secret, byte[]>();
|
139 | 150 | for (PreSharedKeyID ext : externalPSKs)
|
|
0 commit comments