[java-opensaml COMMIT] in /trunk: opensaml-parent/pom.xml opensaml-security-api/pom.xml opensaml-security-api/src/mai...
noreply at shibboleth.net
noreply at shibboleth.net
Mon Apr 9 23:06:18 BST 2012
Author: putmanb
Date: Mon Apr 9 23:06:17 2012
New Revision: 3030
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3030&view=rev
Log:
Eliminate dependency on not-yet-commons-ssl. Use instead vt-crypt.
Modified:
trunk/opensaml-parent/pom.xml
trunk/opensaml-security-api/pom.xml
trunk/opensaml-security-api/src/main/java/org/opensaml/security/SecurityHelper.java
trunk/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Util.java
trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/SimpleDecryptionTest.java
Modified: trunk/opensaml-parent/pom.xml
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-parent/pom.xml?rev=3030&r1=3029&r2=3030&view=diff
==============================================================================
--- trunk/opensaml-parent/pom.xml (original)
+++ trunk/opensaml-parent/pom.xml Mon Apr 9 23:06:17 2012
@@ -101,12 +101,6 @@
<dependencyManagement>
<dependencies>
<!-- Compile Dependencies -->
- <!-- TODO remove this and replace rely exclusive vt-crypt -->
- <dependency>
- <groupId>org.apache.commons.ssl</groupId>
- <artifactId>not-yet-commons-ssl</artifactId>
- <version>0.3.9</version>
- </dependency>
<!-- Provided Dependencies -->
Modified: trunk/opensaml-security-api/pom.xml
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-security-api/pom.xml?rev=3030&r1=3029&r2=3030&view=diff
==============================================================================
--- trunk/opensaml-security-api/pom.xml (original)
+++ trunk/opensaml-security-api/pom.xml Mon Apr 9 23:06:17 2012
@@ -27,11 +27,6 @@
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
</dependency>
- <!-- TODO this needs to go -->
- <dependency>
- <groupId>org.apache.commons.ssl</groupId>
- <artifactId>not-yet-commons-ssl</artifactId>
- </dependency>
<!-- Provided Dependencies -->
Modified: trunk/opensaml-security-api/src/main/java/org/opensaml/security/SecurityHelper.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-security-api/src/main/java/org/opensaml/security/SecurityHelper.java?rev=3030&r1=3029&r2=3030&view=diff
==============================================================================
--- trunk/opensaml-security-api/src/main/java/org/opensaml/security/SecurityHelper.java (original)
+++ trunk/opensaml-security-api/src/main/java/org/opensaml/security/SecurityHelper.java Mon Apr 9 23:06:17 2012
@@ -55,7 +55,6 @@
import net.shibboleth.utilities.java.support.codec.Base64Support;
import net.shibboleth.utilities.java.support.collection.LazyMap;
-import org.apache.commons.ssl.PKCS8Key;
import org.opensaml.security.credential.BasicCredential;
import org.opensaml.security.credential.Credential;
import org.opensaml.security.x509.BasicX509Credential;
@@ -63,6 +62,9 @@
import org.slf4j.LoggerFactory;
import com.google.common.io.Files;
+
+import edu.vt.middleware.crypt.CryptException;
+import edu.vt.middleware.crypt.io.PrivateKeyCredentialReader;
/**
* Helper methods for security-related requirements.
@@ -330,12 +332,19 @@
* @throws KeyException thrown if the key can not be decoded
*/
public static PrivateKey decodePrivateKey(byte[] key, char[] password) throws KeyException {
- try {
- PKCS8Key deocodedKey = new PKCS8Key(key, password);
- return deocodedKey.getPrivateKey();
- } catch (GeneralSecurityException e) {
- throw new KeyException("Unable to decode private key", e);
- }
+ PrivateKeyCredentialReader credReader = new PrivateKeyCredentialReader();
+ ByteArrayInputStream bais = new ByteArrayInputStream(key);
+ try {
+ if (password != null && password.length > 0) {
+ return credReader.read(bais, password);
+ } else {
+ return credReader.read(bais);
+ }
+ } catch (IOException e) {
+ throw new KeyException("Unable to decode private key", e);
+ } catch (CryptException e) {
+ throw new KeyException("Unable to decode private key", e);
+ }
}
/**
@@ -440,7 +449,7 @@
* @throws KeyException thrown if there is an error constructing key
*/
public static PrivateKey buildJavaPrivateKey(String base64EncodedKey) throws KeyException {
- return SecurityHelper.decodePrivateKey(Base64Support.decode(base64EncodedKey), null);
+ return decodePrivateKey(Base64Support.decode(base64EncodedKey), null);
}
/**
Modified: trunk/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Util.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Util.java?rev=3030&r1=3029&r2=3030&view=diff
[... 62 lines stripped ...]
More information about the commits
mailing list