Skip to content
Snippets Groups Projects
Commit 80647a0b authored by Daniel Bleichenbacher's avatar Daniel Bleichenbacher Committed by Tink Team
Browse files

Ignoring test vectors that cause exceptions that are not related

to tink.

PiperOrigin-RevId: 199640605
GitOrigin-RevId: edbadccec7f04d3b8f9b41611e167b2dfc2a1bad
parent b2b6617f
No related branches found
No related tags found
No related merge requests found
......@@ -486,8 +486,17 @@ public class EllipticCurvesTest {
try {
EllipticCurves.CurveType curveType = WycheproofTestUtil.getCurveType(curve);
ECPrivateKey privKey = EllipticCurves.getEcPrivateKey(curveType, Hex.decode(hexPrivKey));
X509EncodedKeySpec x509keySpec = new X509EncodedKeySpec(Hex.decode(hexPubKey));
ECPublicKey pubKey = (ECPublicKey) kf.generatePublic(x509keySpec);
ECPublicKey pubKey;
try {
X509EncodedKeySpec x509keySpec = new X509EncodedKeySpec(Hex.decode(hexPubKey));
pubKey = (ECPublicKey) kf.generatePublic(x509keySpec);
} catch (java.lang.RuntimeException ex) {
// Some of the test vectors contain incorrectly encoded public keys.
// Some java providers do not properly check the encoding, which often results in
// RuntimeExceptions. Since the decoding is not part of tink, we can simply ignore
// these test vectors here.
continue;
}
String sharedSecret = Hex.encode(EllipticCurves.computeSharedSecret(privKey, pubKey));
if (result.equals("invalid")) {
if (expectedSharedSecret.equals(sharedSecret)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment