Index: content/test/data/webcrypto/bad_rsa_keys.json |
diff --git a/content/test/data/webcrypto/bad_rsa_keys.json b/content/test/data/webcrypto/bad_rsa_keys.json |
new file mode 100644 |
index 0000000000000000000000000000000000000000..08b1fbe427352bf4db9d0f82961fd48326e81ec7 |
--- /dev/null |
+++ b/content/test/data/webcrypto/bad_rsa_keys.json |
@@ -0,0 +1,115 @@ |
+// This file contains incorrect key data in a variety of formats. |
+// "data" -- either a dictionary for JWK, or hex encoded bytes for PKCS8/SPKI. |
+// "format" -- one of: "jwk", "pkcs8", "spki" |
+// "error" -- The expected rejection reason when importing the key. |
+[ |
+ |
+ // This is a valid key (ValidKey). It forms the basis for later manipulations |
+ // so its validity is tested separatelty. |
+ { |
+ "format": "jwk", |
+ "data": { |
+ "kty": "RSA", |
+ "d": "ZmJJJ3PBfirgPEOb844fI_1_zXn3A09X9fkk-65xeTNo3JeigTPpuB54FC_GXUmqiXLVx5gynO6cwl9wjxVKYQ", |
+ "dp": "DOUuUiDhtjpnCuIjcGRWhQYok8NeUO5XV1Uwx1-DxtU", |
+ "dq": "mKOBL1e74J8OuGtW1kc2-s4VEP5Eeiwe__TAeBm-roE", |
+ "e": "AQAB", |
+ "n": "tFJAFt_UiJsHlRavDgOxOnYKTHkV-cF1aTDtkzNg6WYt9geaPbAvFnR3FVO0BFsl8tzPzMOTkI_kbOfCfAw3FQ", |
+ "p": "7kMQn01JVhyHM7B85hLUuNBDsXiboMc4Di81qmxX7r0", |
+ "q": "wb7rEiGxG4CrybVYns9voNQM2NPCuCEgWPLA_vCkuzk", |
+ "qi": "6rrPQ4YaOLNGtG7TrLXUR_FSWpOFSUveHTHbFQU6iNU" |
+ }, |
+ // This should pass import. |
+ "error": "Success" |
+ }, |
+ |
+ // This was a valid key (ValidKey), and then "p" and "q" were switched. |
+ // (making dp, dq, and qi invalid). |
+ { |
+ "format": "jwk", |
+ "data": { |
+ "kty": "RSA", |
+ "d": "ZmJJJ3PBfirgPEOb844fI_1_zXn3A09X9fkk-65xeTNo3JeigTPpuB54FC_GXUmqiXLVx5gynO6cwl9wjxVKYQ", |
+ "dp": "DOUuUiDhtjpnCuIjcGRWhQYok8NeUO5XV1Uwx1-DxtU", |
+ "dq": "mKOBL1e74J8OuGtW1kc2-s4VEP5Eeiwe__TAeBm-roE", |
+ "e": "AQAB", |
+ "n": "tFJAFt_UiJsHlRavDgOxOnYKTHkV-cF1aTDtkzNg6WYt9geaPbAvFnR3FVO0BFsl8tzPzMOTkI_kbOfCfAw3FQ", |
+ "q": "7kMQn01JVhyHM7B85hLUuNBDsXiboMc4Di81qmxX7r0", |
+ "p": "wb7rEiGxG4CrybVYns9voNQM2NPCuCEgWPLA_vCkuzk", |
+ "qi": "6rrPQ4YaOLNGtG7TrLXUR_FSWpOFSUveHTHbFQU6iNU" |
+ }, |
+ "error": "OperationError" |
+ }, |
+ |
+ // This was a valid key (ValidKey), and then "p" and "q" were switched, as |
+ // well as "dp" and "dq" (making qi invalid). |
+ { |
+ "format": "jwk", |
+ "data": { |
+ "kty": "RSA", |
+ "d": "ZmJJJ3PBfirgPEOb844fI_1_zXn3A09X9fkk-65xeTNo3JeigTPpuB54FC_GXUmqiXLVx5gynO6cwl9wjxVKYQ", |
+ "dq": "DOUuUiDhtjpnCuIjcGRWhQYok8NeUO5XV1Uwx1-DxtU", |
+ "dp": "mKOBL1e74J8OuGtW1kc2-s4VEP5Eeiwe__TAeBm-roE", |
+ "e": "AQAB", |
+ "n": "tFJAFt_UiJsHlRavDgOxOnYKTHkV-cF1aTDtkzNg6WYt9geaPbAvFnR3FVO0BFsl8tzPzMOTkI_kbOfCfAw3FQ", |
+ "q": "7kMQn01JVhyHM7B85hLUuNBDsXiboMc4Di81qmxX7r0", |
+ "p": "wb7rEiGxG4CrybVYns9voNQM2NPCuCEgWPLA_vCkuzk", |
+ "qi": "6rrPQ4YaOLNGtG7TrLXUR_FSWpOFSUveHTHbFQU6iNU" |
+ }, |
+ "error": "OperationError" |
+ }, |
+ |
+ // This was (ValidKey), where p and q were switched (dp, and dq were also |
+ // flipped, and qi was recomputed using the new q). |
+ // |
+ // TODO(eroman): This test is commented out because it does not pass when |
+ // using certain versions of NSS, due to: |
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1049435 |
+ // Versions of NSS after 3.17.2 will pass this test. |
+ // Enable this test once NSS is updated on all the bots, or chromium has |
+ // switched to BoringSSL. |
+//{ |
+// "format": "jwk", |
+// "data": { |
+// "kty": "RSA", |
+// "d": "ZmJJJ3PBfirgPEOb844fI_1_zXn3A09X9fkk-65xeTNo3JeigTPpuB54FC_GXUmqiXLVx5gynO6cwl9wjxVKYQ", |
+// "dq": "DOUuUiDhtjpnCuIjcGRWhQYok8NeUO5XV1Uwx1-DxtU", |
+// "dp": "mKOBL1e74J8OuGtW1kc2-s4VEP5Eeiwe__TAeBm-roE", |
+// "e": "AQAB", |
+// "n": "tFJAFt_UiJsHlRavDgOxOnYKTHkV-cF1aTDtkzNg6WYt9geaPbAvFnR3FVO0BFsl8tzPzMOTkI_kbOfCfAw3FQ", |
+// "q": "7kMQn01JVhyHM7B85hLUuNBDsXiboMc4Di81qmxX7r0", |
+// "p": "wb7rEiGxG4CrybVYns9voNQM2NPCuCEgWPLA_vCkuzk", |
+// "qi": "At9OiWPsUGogvxI5FR0mMURSjnu1mZgyFXi7fX56Bl0" |
+// }, |
+// // This should pass import. |
+// "error": "Success" |
+//}, |
+ |
+ // The provided SPKI is empty. |
+ { |
+ "format": "spki", |
+ "data": "", |
+ "error": "DataError: No key data was provided" |
+ }, |
+ |
+ // The provided PKCS8 is empty. |
+ { |
+ "format": "pkcs8", |
+ "data": "", |
+ "error": "DataError: No key data was provided" |
+ }, |
+ |
+ // Bad DER encoding for SPKI. |
+ { |
+ "format": "spki", |
+ "data": "618333c4cb", |
+ "error": "DataError" |
+ }, |
+ |
+ // Bad DER encoding for PKCS8. |
+ { |
+ "format": "pkcs8", |
+ "data": "618333c4cb", |
+ "error": "DataError" |
+ } |
+] |