@@ -147,6 +147,24 @@ public void testBuild_ShouldThrowIllegalArgumentException_WhenMultipleWildcardsO
147147 .build ();
148148 }
149149
150+ @ Test
151+ public void testBuild_ShouldComputeCertificateKeyFingerprin () throws Exception {
152+ EncryptionConfig config = JweConfigBuilder .aJweEncryptionConfig ()
153+ .withEncryptionCertificate (TestUtils .getTestEncryptionCertificate ())
154+ .withDecryptionKey (TestUtils .getTestDecryptionKey ())
155+ .build ();
156+ Assert .assertEquals ("761b003c1eade3a5490e5000d37887baa5e6ec0e226c07706e599451fc032a79" , config .getEncryptionKeyFingerprint ());
157+ }
158+
159+ @ Test
160+ public void testBuild_ShouldComputeEncryptionKeyFingerprin () throws Exception {
161+ EncryptionConfig config = JweConfigBuilder .aJweEncryptionConfig ()
162+ .withEncryptionKey (TestUtils .getTestEncryptionCertificate ().getPublicKey ())
163+ .withDecryptionKey (TestUtils .getTestDecryptionKey ())
164+ .build ();
165+ Assert .assertEquals ("761b003c1eade3a5490e5000d37887baa5e6ec0e226c07706e599451fc032a79" , config .getEncryptionKeyFingerprint ());
166+ }
167+
150168 @ Test
151169 public void testBuild_ShouldNotComputeCertificateKeyFingerprint_WhenFingerprintSet () throws Exception {
152170 EncryptionConfig config = JweConfigBuilder .aJweEncryptionConfig ()
@@ -156,4 +174,14 @@ public void testBuild_ShouldNotComputeCertificateKeyFingerprint_WhenFingerprintS
156174 .build ();
157175 Assert .assertEquals ("2f4lvi26vJWzkzAIaiR2G0YsJAQ=" , config .getEncryptionKeyFingerprint ());
158176 }
177+
178+ @ Test
179+ public void testBuild_ShouldNotComputeEncryptionKeyFingerprint_WhenFingerprintSet () throws Exception {
180+ EncryptionConfig config = JweConfigBuilder .aJweEncryptionConfig ()
181+ .withEncryptionKey (TestUtils .getTestEncryptionCertificate ().getPublicKey ())
182+ .withDecryptionKey (TestUtils .getTestDecryptionKey ())
183+ .withEncryptionKeyFingerprint ("2f4lvi26vJWzkzAIaiR2G0YsJAQ=" )
184+ .build ();
185+ Assert .assertEquals ("2f4lvi26vJWzkzAIaiR2G0YsJAQ=" , config .getEncryptionKeyFingerprint ());
186+ }
159187}
0 commit comments