[java-shib-shared] branch main updated: JSSH-74 - Separate DataSealer exception for key expiration/absence

Codeberg noreply at shibboleth.net
Tue Jul 14 16:56:08 UTC 2026


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

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

View the commit online:
https://codeberg.org/Shibboleth/java-shib-shared/commit/c6e37182a7545f5cd04b92fd0d604735d419acd9

The following commit(s) were added to refs/heads/main by this push:
     new c6e37182 JSSH-74 - Separate DataSealer exception for key expiration/absence
c6e37182 is described below

commit c6e37182a7545f5cd04b92fd0d604735d419acd9
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Tue Jul 14 12:55:57 2026 -0400

    JSSH-74 - Separate DataSealer exception for key expiration/absence
    
    https://shibboleth.atlassian.net/browse/JSSH-74
    
    Added KeyExpiredException for this case.
---
 .../net/shibboleth/shared/security/DataSealer.java | 11 ++--
 .../shared/security/KeyExpiredException.java       | 65 ++++++++++++++++++++++
 2 files changed, 69 insertions(+), 7 deletions(-)

diff --git a/shib-security/src/main/java/net/shibboleth/shared/security/DataSealer.java b/shib-security/src/main/java/net/shibboleth/shared/security/DataSealer.java
index 1c9f4834..c7df148d 100644
--- a/shib-security/src/main/java/net/shibboleth/shared/security/DataSealer.java
+++ b/shib-security/src/main/java/net/shibboleth/shared/security/DataSealer.java
@@ -54,7 +54,7 @@ import net.shibboleth.shared.security.DataSealerKeyStrategy.NamedKey;
 /**
  * Applies a MAC to time-limited information and encrypts with a symmetric key.
  * 
- * TODO: make final
+ * TODO: make into an interface, so do NOT extend this class
  */
 public class DataSealer extends AbstractInitializableComponent {
 
@@ -290,12 +290,9 @@ public class DataSealer extends AbstractInitializableComponent {
             }
 
         } catch (final KeyNotFoundException e) {
-            if (keyUsed != null) {
-                log.info("Data was wrapped with a key ({}) no longer available", keyUsed.toString());
-            } else {
-                log.info("Data was wrapped with a key no longer available");
-            }
-            throw new DataExpiredException("Data wrapped with expired key");
+            log.info("Data was wrapped with a key ({}) no longer available",
+                    keyUsed != null ? keyUsed.toString() : "unknown");
+            throw new KeyExpiredException("Data wrapped with expired or missing key", e);
         } catch (final KeyException e) {
             log.error(e.getMessage());
             throw new DataSealerException("Exception loading key", e);
diff --git a/shib-security/src/main/java/net/shibboleth/shared/security/KeyExpiredException.java b/shib-security/src/main/java/net/shibboleth/shared/security/KeyExpiredException.java
new file mode 100644
index 00000000..db05f7f9
--- /dev/null
+++ b/shib-security/src/main/java/net/shibboleth/shared/security/KeyExpiredException.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.shared.security;
+
+import javax.annotation.Nullable;
+
+/**
+ * Indicates the sealed data was sealed with an absent or expired key.
+ * 
+ * @since 9.3.0
+ */
+public class KeyExpiredException extends DataSealerException {
+
+    /**
+     * serialVersionUID.
+     */
+    private static final long serialVersionUID = -5791651650775442978L;
+
+    /**
+     * Constructor.
+     */
+    public KeyExpiredException() {
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param message exception message
+     */
+    public KeyExpiredException(@Nullable final String message) {
+        super(message);
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param wrappedException exception to be wrapped by this one
+     */
+    public KeyExpiredException(@Nullable final Exception wrappedException) {
+        super(wrappedException);
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param message exception message
+     * @param wrappedException exception to be wrapped by this one
+     */
+    public KeyExpiredException(@Nullable final String message, @Nullable final Exception wrappedException) {
+        super(message, wrappedException);
+    }
+
+}
\ No newline at end of file

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


More information about the commits mailing list