cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Adding few more JWK thumbprints tests with thanks to Brian Campbell
Date Mon, 05 Oct 2015 16:13:43 GMT
Repository: cxf
Updated Branches:
  refs/heads/master d04f83cec -> bdad3fe6b


Adding few more JWK thumbprints tests with thanks to Brian Campbell


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/bdad3fe6
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/bdad3fe6
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/bdad3fe6

Branch: refs/heads/master
Commit: bdad3fe6b8a6062e751909578e1376a02b051ef8
Parents: d04f83c
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Oct 5 17:13:25 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Oct 5 17:13:25 2015 +0100

----------------------------------------------------------------------
 .../cxf/rs/security/jose/jwk/JwkUtilsTest.java  | 53 +++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/bdad3fe6/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwk/JwkUtilsTest.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwk/JwkUtilsTest.java
b/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwk/JwkUtilsTest.java
index 34d3183..3f62f4f 100644
--- a/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwk/JwkUtilsTest.java
+++ b/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwk/JwkUtilsTest.java
@@ -33,11 +33,62 @@ public class JwkUtilsTest extends Assert {
       + "\"e\": \"AQAB\","
       + "\"alg\": \"RS256\","
       + "\"kid\": \"2011-04-29\""
-      + "}\"";
+      + "}";
+    private static final String EC_256_KEY = "{"
+        + "\"kty\": \"EC\","
+        + "\"x\": \"CEuRLUISufhcjrj-32N0Bvl3KPMiHH9iSw4ohN9jxrA\","
+        + "\"y\": \"EldWz_iXSK3l_S7n4w_t3baxos7o9yqX0IjzG959vHc\","
+        + "\"crv\": \"P-256\""
+        + "}";
+    private static final String EC_384_KEY = "{"
+        + "\"kty\": \"EC\","
+        + "\"x\": \"2jCG5DmKUql9YPn7F2C-0ljWEbj8O8-vn5Ih1k7Wzb-y3NpBLiG1BiRa392b1kcQ\","
+        + "\"y\": \"7Ragi9rT-5tSzaMbJlH_EIJl6rNFfj4V4RyFM5U2z4j1hesX5JXa8dWOsE-5wPIl\","
+        + "\"crv\": \"P-384\""
+        + "}";
+    private static final String EC_521_KEY = "{"
+        + "\"kty\": \"EC\","
+        + "\"x\": \"Aeq3uMrb3iCQEt0PzSeZMmrmYhsKP5DM1oMP6LQzTFQY9-F3Ab45xiK4AJxltXEI-87g3gRwId88hTyHgq180JDt\","
+        + "\"y\": \"ARA0lIlrZMEzaXyXE4hjEkc50y_JON3qL7HSae9VuWpOv_2kit8p3pyJBiRb468_U5ztLT7FvDvtimyS42trhDTu\","
+        + "\"crv\": \"P-521\""
+        + "}";
+    private static final String OCTET_KEY_1 = "{"
+        + "\"kty\": \"oct\","
+        + "\"k\": \"ZW8Eg8TiwoT2YamLJfC2leYpLgLmUAh_PcMHqRzBnMg\""
+        + "}";
+    private static final String OCTET_KEY_2 = "{"
+        + "\"kty\": \"oct\","
+        + "\"k\": \"NGbwp1rC4n85A1SaNxoHow\""
+        + "}";
     @Test
     public void testRsaKeyThumbprint() throws Exception {
         String thumbprint = JwkUtils.getThumbprint(RSA_KEY);
         assertEquals("NzbLsXh8uDCcd-6MNwXF4W_7noWXFZAfHkxZsRGC9Xs", thumbprint);
     }
+    @Test
+    public void testOctetKey1Thumbprint() throws Exception {
+        String thumbprint = JwkUtils.getThumbprint(OCTET_KEY_1);
+        assertEquals("7WWD36NF4WCpPaYtK47mM4o0a5CCeOt01JXSuMayv5g", thumbprint);
+    }
+    @Test
+    public void testOctetKey2Thumbprint() throws Exception {
+        String thumbprint = JwkUtils.getThumbprint(OCTET_KEY_2);
+        assertEquals("5_qb56G0OJDw-lb5mkDaWS4MwuY0fatkn9LkNqUHqMk", thumbprint);
+    }
+    @Test
+    public void testEc256KeyThumbprint() throws Exception {
+        String thumbprint = JwkUtils.getThumbprint(EC_256_KEY);
+        assertEquals("j4UYwo9wrtllSHaoLDJNh7MhVCL8t0t8cGPPzChpYDs", thumbprint);
+    }
+    @Test
+    public void testEc384KeyThumbprint() throws Exception {
+        String thumbprint = JwkUtils.getThumbprint(EC_384_KEY);
+        assertEquals("vZtaWIw-zw95JNzzURg1YB7mWNLlm44YZDZzhrPNetM", thumbprint);
+    }
+    @Test
+    public void testEc521KeyThumbprint() throws Exception {
+        String thumbprint = JwkUtils.getThumbprint(EC_521_KEY);
+        assertEquals("rz4Ohmpxg-UOWIWqWKHlOe0bHSjNUFlHW5vwG_M7qYg", thumbprint);
+    }
     
 }


Mime
View raw message