diff options
author | bleichen <bleichen@google.com> | 2023-02-21 08:26:19 -0800 |
---|---|---|
committer | Charles Lee <ckl@google.com> | 2023-02-27 16:44:39 -0800 |
commit | ce45149c3931db8a27df06198a209c69206c9c29 (patch) | |
tree | 1e5dc7102a6651b2b8fc795d9dc72268a65afaa1 | |
parent | d22747720d98d28ba8209f9fe729eda68a96ab64 (diff) | |
download | wycheproof-ce45149c3931db8a27df06198a209c69206c9c29.tar.gz |
Removing the option to add test vectors with JSON serialization.
Currently all test vectors use the compact form for the "jws" field.
If we ever add tests where the jws uses another format then these
tests would be in a different test vector file.
NOKEYCHECK=True
PiperOrigin-RevId: 511207630
-rw-r--r-- | java/com/google/security/wycheproof/jose4j/JsonWebKeyTest.java | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/java/com/google/security/wycheproof/jose4j/JsonWebKeyTest.java b/java/com/google/security/wycheproof/jose4j/JsonWebKeyTest.java index fc5a4d5..6aa82ad 100644 --- a/java/com/google/security/wycheproof/jose4j/JsonWebKeyTest.java +++ b/java/com/google/security/wycheproof/jose4j/JsonWebKeyTest.java @@ -121,7 +121,7 @@ public class JsonWebKeyTest { JsonObject publicJwk = testGroup.getAsJsonObject("public"); String verificationJwk = publicJwk == null ? privateJwk : publicJwk.toString(); - String jws = getFlattenedString(testCase, "jws"); + String jws = testCase.get("jws").getAsString(); boolean expectedResult = testCase.get("result").getAsString().equals("valid"); boolean result = performKeysetVerification(jws, verificationJwk); @@ -137,17 +137,6 @@ public class JsonWebKeyTest { } } - /** Reads the JWS/JWE field either in compact or JSON serialization form. */ - private static String getFlattenedString(JsonObject jsonObject, String fieldName) { - JsonElement element = jsonObject.get(fieldName); - if (element.isJsonPrimitive()) { - // This is a compact representation of the JWE/JWS. - return element.getAsString(); - } - // This is a JSON representation of the JWE/JWS. - return element.toString(); - } - /** * Returns whether or not the payload verifies with any of the given keys. * |