[utilities COMMIT] in /java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/security: BasicKeystore...

noreply at shibboleth.net noreply at shibboleth.net
Sun Mar 1 14:06:08 EST 2015


Author: scantor
Date: Sun Mar  1 14:06:08 2015
New Revision: 769

URL: http://svn.shibboleth.net/view/utilities?rev=769&view=rev
Log:
IDP-630 - exception shown if data sealer can't find expired key 

Added:
    java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/security/KeyNotFoundException.java   (with props)
Modified:
    java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/security/BasicKeystoreKeyStrategy.java
    java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/security/DataSealer.java

Modified: java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/security/BasicKeystoreKeyStrategy.java
URL: http://svn.shibboleth.net/view/utilities/java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/security/BasicKeystoreKeyStrategy.java?rev=769&r1=768&r2=769&view=diff
==============================================================================
--- java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/security/BasicKeystoreKeyStrategy.java (original)
+++ java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/security/BasicKeystoreKeyStrategy.java Sun Mar  1 14:06:08 2015
@@ -286,8 +286,8 @@
 
             final Key loadedKey = ks.getKey(name, keyPassword.toCharArray());
             if (loadedKey == null) {
-                log.error("Key '{}' not found", name);
-                throw new KeyException("Key was not found in keystore");
+                log.info("Key '{}' not found", name);
+                throw new KeyNotFoundException("Key was not present in keystore");
             } else if (!(loadedKey instanceof SecretKey)) {
                 log.error("Key '{}' is not a symmetric key", name);
                 throw new KeyException("Key was of incorrect type");

Modified: java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/security/DataSealer.java
URL: http://svn.shibboleth.net/view/utilities/java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/security/DataSealer.java?rev=769&r1=768&r2=769&view=diff
==============================================================================
--- java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/security/DataSealer.java (original)
+++ java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/security/DataSealer.java Sun Mar  1 14:06:08 2015
@@ -180,6 +180,13 @@
         } catch (final IllegalStateException | InvalidCipherTextException| IOException e) {
             log.error(e.getMessage());
             throw new DataSealerException("Exception unwrapping data", e);
+        } 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");
         } catch (final KeyException e) {
             log.error(e.getMessage());
             throw new DataSealerException("Exception loading key", e);



More information about the commits mailing list