You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by ru...@apache.org on 2006/03/21 05:39:07 UTC
svn commit: r387405 - in
/webservices/wss4j/trunk/src/org/apache/ws/security/message:
WSSecEncrypt.java WSSecEncryptedKey.java
Author: ruchithf
Date: Mon Mar 20 20:39:06 2006
New Revision: 387405
URL: http://svn.apache.org/viewcvs?rev=387405&view=rev
Log:
Allow the WSSecEncryptedKey to be able to work on an external cert. Moved the code from WSSecEncrypt
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java?rev=387405&r1=387404&r2=387405&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java Mon Mar 20 20:39:06 2006
@@ -60,8 +60,6 @@
protected String embeddedKeyName = null;
- protected X509Certificate useThisCert = null;
-
/**
* Symmetric key used in the EncrytpedKey.
*/
@@ -112,20 +110,6 @@
*/
public void setEmbeddedKeyName(String embeddedKeyName) {
this.embeddedKeyName = embeddedKeyName;
- }
-
- /**
- * Set the X509 Certificate to use for encryption.
- *
- * If this is set <b>and</b> the key identifier is set to
- * <code>DirectReference</code> then use this certificate to get the
- * public key for encryption.
- *
- * @param cert
- * is the X509 certificate to use for encryption
- */
- public void setUseThisCert(X509Certificate cert) {
- useThisCert = cert;
}
/**
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java?rev=387405&r1=387404&r2=387405&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java Mon Mar 20 20:39:06 2006
@@ -93,6 +93,8 @@
* is used to refer to the asymm encryption cert
*/
protected BinarySecurity bstToken = null;
+
+ protected X509Certificate useThisCert = null;
/**
* This will actually prepend the <code>EncryptedKey</code> to the
@@ -166,13 +168,17 @@
* algorithm that will encrypt the generated symmetric (session) key.
*/
X509Certificate remoteCert = null;
-
- X509Certificate[] certs = crypto.getCertificates(user);
- if (certs == null || certs.length <= 0) {
- throw new WSSecurityException(WSSecurityException.FAILURE,
- "invalidX509Data", new Object[] { "for Encryption" });
+ if (useThisCert != null) {
+ remoteCert = useThisCert;
+ } else {
+ X509Certificate[] certs = crypto.getCertificates(user);
+ if (certs == null || certs.length <= 0) {
+ throw new WSSecurityException(WSSecurityException.FAILURE,
+ "invalidX509Data", new Object[] { "for Encryption" });
+ }
+ remoteCert = certs[0];
}
- remoteCert = certs[0];
+
prepareInternal(ephemeralKey, remoteCert, crypto);
}
@@ -382,5 +388,19 @@
*/
public byte[] getEphemeralKey() {
return ephemeralKey;
+ }
+
+ /**
+ * Set the X509 Certificate to use for encryption.
+ *
+ * If this is set <b>and</b> the key identifier is set to
+ * <code>DirectReference</code> then use this certificate to get the
+ * public key for encryption.
+ *
+ * @param cert
+ * is the X509 certificate to use for encryption
+ */
+ public void setUseThisCert(X509Certificate cert) {
+ useThisCert = cert;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org