[java-identity-provider COMMIT] in /trunk: idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relying...

noreply at shibboleth.net noreply at shibboleth.net
Tue Dec 16 20:01:41 EST 2014


Author: putmanb
Date: Tue Dec 16 20:01:40 2014
New Revision: 7126

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7126&view=rev
Log:
Update security schema, parsers and factory beans to support SecretKey Credentials.

Added:
    trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/security/credential/aes-base64.txt   (with props)
    trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/security/credential/aes-binary.data
    trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/security/credential/aes-hex.txt   (with props)
    trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/security/credential/fileSecretAESBase64.xml   (with props)
    trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/security/credential/fileSecretAESBinary.xml   (with props)
    trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/security/credential/fileSecretAESHex.xml   (with props)
    trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/security/credential/secretKeyAESBase64.xml   (with props)
    trunk/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/security/credential/secretKeyAESHex.xml   (with props)
Modified:
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/AbstractBasicCredentialFactoryBean.java
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/AbstractBasicCredentialParser.java
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/BasicInlineCredentialFactoryBean.java
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/BasicResourceCredentialFactoryBean.java
    trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/BasicInlineParserTest.java
    trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/BasicResourceParserTest.java
    trunk/idp-schema/src/main/resources/schema/shibboleth-security.xsd

Modified: trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/AbstractBasicCredentialFactoryBean.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/AbstractBasicCredentialFactoryBean.java?rev=7126&r1=7125&r2=7126&view=diff
==============================================================================
--- trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/AbstractBasicCredentialFactoryBean.java (original)
+++ trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/AbstractBasicCredentialFactoryBean.java Tue Dec 16 20:01:40 2014
@@ -17,14 +17,20 @@
 
 package net.shibboleth.idp.profile.spring.relyingparty.security.credential;
 
+import java.io.UnsupportedEncodingException;
 import java.security.PrivateKey;
 import java.security.PublicKey;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.crypto.SecretKey;
 
 import net.shibboleth.idp.profile.spring.relyingparty.metadata.ResourceBackedMetadataProviderParser;
-
+import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
+
+import org.apache.commons.codec.binary.Base64;
+import org.bouncycastle.util.encoders.Hex;
 import org.cryptacular.util.KeyPairUtil;
 import org.opensaml.security.credential.BasicCredential;
 import org.opensaml.security.credential.UsageType;
@@ -37,11 +43,72 @@
  */
 public abstract class AbstractBasicCredentialFactoryBean extends AbstractCredentialFactoryBean<BasicCredential> {
     
+    /** Form of encoding for SecretKey info. */
+    public enum SecretKeyEncoding {
+       /** Raw binary encoding. */
+       binary,
+       /** Hexidecimal encoding. */
+       hex,
+       /** Base64 encoding. */
+       base64
+    }
+    
     /** Log. */
     private final Logger log = LoggerFactory.getLogger(ResourceBackedMetadataProviderParser.class);
 
-    /** The secretKey Password (if any). */
-    @Nullable private char[] secretKeyPassword;
+    /** The SecretKey algorithm. */
+    @Nullable private String secretKeyAlgorithm;
+    
+    /** The SecretKey encoding used. */
+    @Nullable private SecretKeyEncoding secretKeyEncoding = SecretKeyEncoding.base64;
+    
+    /**
+     * Decode the SecretKey data, based on the specified encoding.
+     * 
+     * @param data the Secret key data
+     * @return the decoded SecretKey byte array
+     */
+    protected byte[] decodeSecretKey(String data) {

[... 336 lines stripped ...]


More information about the commits mailing list