[java-opensaml COMMIT] in /trunk: opensaml-security-api/src/main/java/org/opensaml/security/crypto/KeySupport.java op...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Jan 30 20:42:45 EST 2013
Author: scantor
Date: Wed Jan 30 20:42:45 2013
New Revision: 3195
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3195&view=rev
Log:
Port java-xmltooling r771
Modified:
trunk/opensaml-security-api/src/main/java/org/opensaml/security/crypto/KeySupport.java
trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/EncryptionConstants.java
Modified: trunk/opensaml-security-api/src/main/java/org/opensaml/security/crypto/KeySupport.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-security-api/src/main/java/org/opensaml/security/crypto/KeySupport.java?rev=3195&r1=3194&r2=3195&view=diff
==============================================================================
--- trunk/opensaml-security-api/src/main/java/org/opensaml/security/crypto/KeySupport.java (original)
+++ trunk/opensaml-security-api/src/main/java/org/opensaml/security/crypto/KeySupport.java Wed Jan 30 20:42:45 2013
@@ -34,6 +34,7 @@
import java.security.interfaces.DSAParams;
import java.security.interfaces.DSAPrivateKey;
import java.security.interfaces.DSAPublicKey;
+import java.security.interfaces.ECPrivateKey;
import java.security.interfaces.ECPublicKey;
import java.security.interfaces.RSAKey;
import java.security.interfaces.RSAPrivateCrtKey;
@@ -310,6 +311,21 @@
}
/**
+ * Build Java EC private key from base64 encoding.
+ *
+ * @param base64EncodedKey base64-encoded EC private key
+ * @return a native Java ECPrivateKey
+ * @throws KeyException thrown if there is an error constructing key
+ */
+ public static ECPrivateKey buildJavaECPrivateKey(String base64EncodedKey) throws KeyException {
+ PrivateKey key = buildJavaPrivateKey(base64EncodedKey);
+ if (! (key instanceof ECPrivateKey)) {
+ throw new KeyException("Generated key was not an ECPrivateKey instance");
+ }
+ return (ECPrivateKey) key;
+ }
+
+ /**
* Build Java private key from base64 encoding. The key should have no password.
*
* @param base64EncodedKey base64-encoded private key
Modified: trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/EncryptionConstants.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/EncryptionConstants.java?rev=3195&r1=3194&r2=3195&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/EncryptionConstants.java (original)
+++ trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/EncryptionConstants.java Wed Jan 30 20:42:45 2013
@@ -18,7 +18,7 @@
package org.opensaml.xmlsec.encryption.support;
/**
- * Constants defined in or related to the XML Encryption specification, version 20021210.
+ * Constants defined in or related to the XML Encryption 1.0 and 1.1 specifications.
*/
public final class EncryptionConstants {
@@ -64,10 +64,10 @@
// *************************************************
// Key Transport
// *************************************************
- /** Key Transport - REQUIRED RSA-v1.5. */
+ /** Key Transport - OPTIONAL RSA-v1.5. */
public static final String ALGO_ID_KEYTRANSPORT_RSA15 = XMLENC_NS + "rsa-1_5";
- /** Key Transport - REQUIRED RSA-OAEP. */
+ /** Key Transport - REQUIRED RSA-OAEP (including MGF1 with SHA1). */
public static final String ALGO_ID_KEYTRANSPORT_RSAOAEP = XMLENC_NS + "rsa-oaep-mgf1p";
// *************************************************
@@ -94,7 +94,7 @@
// *************************************************
// Message Digest
// *************************************************
- /** Message Digest - RECOMMENDED SHA256. */
+ /** Message Digest - REQUIRED SHA256. */
public static final String ALGO_ID_DIGEST_SHA256 = XMLENC_NS + "sha256";
/** Message Digest - OPTIONAL SHA512. */
@@ -103,6 +103,30 @@
/** Message Digest - OPTIONAL RIPEMD-160. */
public static final String ALGO_ID_DIGEST_RIPEMD160 = XMLENC_NS + "ripemd160";
+ // *********************************************************
+ // Some additional algorithm URIs from XML Encryption 1.1
+ // *********************************************************
+ /** XML Encryption 1.1 namespace. */
+ public static final String XMLENC11_NS = "http://www.w3.org/2009/xmlenc11#";
+
+ /** XML Encryption 1.1 QName prefix. */
+ public static final String XMLENC11_PREFIX = "xenc11";
+
+ /** Key Transport - OPTIONAL RSA-OAEP. */
+ public static final String ALGO_ID_KEYTRANSPORT_RSAOAEP11 = XMLENC11_NS + "rsa-oaep";
+
+ /** Block Encryption - REQUIRED AES128-GCM. */
+ public static final String ALGO_ID_BLOCKCIPHER_AES128_GCM = XMLENC11_NS + "aes128-gcm";
+
+ /** Block Encryption - OPTIONAL AES192-GCM. */
+ public static final String ALGO_ID_BLOCKCIPHER_AES192_GCM = XMLENC11_NS + "aes192-gcm";
+
+ /** Block Encryption - OPTIONAL AES256-GCM. */
[... 9 lines stripped ...]
More information about the commits
mailing list