Fixed a bug that caused crypto handle expiration times to not take effect.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 30 Mar 2005 21:49:40 +0000 (21:49 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 30 Mar 2005 21:49:40 +0000 (21:49 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@1353 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/hs/provider/CryptoShibHandle.java

index f76aa95..9d12371 100644 (file)
@@ -204,8 +204,7 @@ public class CryptoShibHandle extends AQHNameIdentifierMapping implements NameId
                        long decodedExpirationTime = dataStream.readLong();
                        String decodedPrincipal = dataStream.readUTF();
 
-                       HMACHandleEntry macHandleEntry = new HMACHandleEntry(
-                                       createHandleEntry(new AuthNPrincipal(decodedPrincipal)));
+                       HMACHandleEntry macHandleEntry = createHMACHandleEntry(new AuthNPrincipal(decodedPrincipal));
                        macHandleEntry.setExpirationTime(decodedExpirationTime);
                        byte[] generatedMac = macHandleEntry.getMAC(mac);
 
@@ -262,8 +261,7 @@ public class CryptoShibHandle extends AQHNameIdentifierMapping implements NameId
 
                        Mac mac = Mac.getInstance(macAlgorithm);
                        mac.init(secret);
-                       HandleEntry handleEntry = createHandleEntry(principal);
-                       HMACHandleEntry macHandleEntry = new HMACHandleEntry(handleEntry);
+                       HMACHandleEntry macHandleEntry = createHMACHandleEntry(principal);
 
                        Cipher cipher = Cipher.getInstance(cipherAlgorithm);
                        byte[] iv = new byte[cipher.getBlockSize()];
@@ -396,6 +394,11 @@ public class CryptoShibHandle extends AQHNameIdentifierMapping implements NameId
                return Arrays.equals(defaultKey, encodedKey);
        }
 
+       protected HMACHandleEntry createHMACHandleEntry(AuthNPrincipal principal) {
+
+               return new HMACHandleEntry(principal, handleTTL);
+       }
+
 }
 
 /**
@@ -409,11 +412,6 @@ class HMACHandleEntry extends HandleEntry {
                super(principal, TTL);
        }
 
-       protected HMACHandleEntry(HandleEntry handleEntry) {
-
-               super(handleEntry.principal, handleEntry.expirationTime);
-       }
-
        private static byte[] getLongBytes(long longValue) {
 
                try {