[java-opensaml] branch main updated: Switch digest call to our StringDigester.

Codeberg noreply at shibboleth.net
Thu Oct 22 14:10:14 UTC 2026


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch main
in repository java-opensaml.

View the commit online:
https://codeberg.org/Shibboleth/java-opensaml/commit/94423b6c23b78184a8ea711c538055328de4e5a5

The following commit(s) were added to refs/heads/main by this push:
     new 94423b6c2 Switch digest call to our StringDigester.
94423b6c2 is described below

commit 94423b6c23b78184a8ea711c538055328de4e5a5
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Thu Oct 22 10:09:54 2026 -0400

    Switch digest call to our StringDigester.
---
 .../storage/impl/StorageServiceRevocationCache.java | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/StorageServiceRevocationCache.java b/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/StorageServiceRevocationCache.java
index f58f31614..3598041ea 100644
--- a/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/StorageServiceRevocationCache.java
+++ b/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/StorageServiceRevocationCache.java
@@ -15,13 +15,13 @@
 package org.opensaml.storage.impl;
 
 import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
 import java.time.Duration;
 import java.time.Instant;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import org.apache.commons.codec.digest.DigestUtils;
 import org.opensaml.storage.RevocationCache;
 import org.opensaml.storage.StorageCapabilities;
 import org.opensaml.storage.StorageRecord;
@@ -32,6 +32,8 @@ import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.annotation.constraint.Positive;
 import net.shibboleth.shared.annotation.constraint.ThreadSafeAfterInit;
+import net.shibboleth.shared.codec.StringDigester;
+import net.shibboleth.shared.codec.StringDigester.OutputFormat;
 import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
 import net.shibboleth.shared.component.ComponentInitializationException;
 import net.shibboleth.shared.logic.Constraint;
@@ -63,6 +65,9 @@ public class StorageServiceRevocationCache extends AbstractIdentifiableInitializ
     /** Default lifetime of revocation entry. Default value: 6 hours */
     @Nonnull @Positive private Duration expires;
 
+    /** Used to shrink large keys. */
+    @Nonnull private StringDigester digester;
+    
     /**
      * Constructor.
      */
@@ -132,6 +137,12 @@ public class StorageServiceRevocationCache extends AbstractIdentifiableInitializ
         if (storage == null) {
             throw new ComponentInitializationException("StorageService cannot be null");
         }
+        
+        try {
+            digester = new StringDigester("SHA1", OutputFormat.HEX_LOWER);
+        } catch (final NoSuchAlgorithmException e) {
+            throw new ComponentInitializationException(e);
+        }
     }
     
     /** {@inheritDoc} */
@@ -151,7 +162,7 @@ public class StorageServiceRevocationCache extends AbstractIdentifiableInitializ
             log.error("context {} too long for StorageService (limit {})", context, caps.getContextSize());
             return false;
         } else if (s.length() > caps.getKeySize()) {
-            key = DigestUtils.sha1Hex(s);
+            key = digester.apply(s);
         } else {
             key = s;
         }
@@ -183,7 +194,7 @@ public class StorageServiceRevocationCache extends AbstractIdentifiableInitializ
             log.error("context {} too long for StorageService (limit {})", context, caps.getContextSize());
             return false;
         } else if (s.length() > caps.getKeySize()) {
-            key = DigestUtils.sha1Hex(s);
+            key = digester.apply(s);
         } else {
             key = s;
         }
@@ -206,7 +217,7 @@ public class StorageServiceRevocationCache extends AbstractIdentifiableInitializ
             log.error("context {} too long for StorageService (limit {})", context, caps.getContextSize());
             return true;
         } else if (s.length() > caps.getKeySize()) {
-            key = DigestUtils.sha1Hex(s);
+            key = digester.apply(s);
         } else {
             key = s;
         }
@@ -238,7 +249,7 @@ public class StorageServiceRevocationCache extends AbstractIdentifiableInitializ
             log.error("context {} too long for StorageService (limit {})", context, caps.getContextSize());
             throw new IOException("Context exceeded storage service limit.");
         } else if (s.length() > caps.getKeySize()) {
-            key = DigestUtils.sha1Hex(s);
+            key = digester.apply(s);
         } else {
             key = s;
         }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list