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/09/10 12:18:20 UTC
svn commit: r441936 - in
/webservices/wss4j/trunk/src/org/apache/ws/security/message:
WSSecDKSign.java WSSecEncryptedKey.java WSSecSignature.java
Author: ruchithf
Date: Sun Sep 10 03:18:15 2006
New Revision: 441936
URL: http://svn.apache.org/viewvc?view=rev&rev=441936
Log:
- Updated WSSecDKSig to be able to set the C14N algo
- Updated WSSecEncryptedKey and WSSecSignature to be able to append the elements to the sec header and to be able to get the BST id
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java?view=diff&rev=441936&r1=441935&r2=441936
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java Sun Sep 10 03:18:15 2006
@@ -438,6 +438,42 @@
public void setSignatureAlgorithm(String algo) {
this.sigAlgo = algo;
}
+
+ /**
+ * @return Returns the signatureValue.
+ */
+ public byte[] getSignatureValue() {
+ return signatureValue;
+ }
+ /**
+ * Set the canonicalization method to use.
+ *
+ * If the canonicalization method is not set then the recommended Exclusive
+ * XML Canonicalization is used by default Refer to WSConstants which
+ * algorithms are supported.
+ *
+ * @param algo
+ * Is the name of the signature algorithm
+ * @see WSConstants#C14N_OMIT_COMMENTS
+ * @see WSConstants#C14N_WITH_COMMENTS
+ * @see WSConstants#C14N_EXCL_OMIT_COMMENTS
+ * @see WSConstants#C14N_EXCL_WITH_COMMENTS
+ */
+ public void setSigCanonicalization(String algo) {
+ canonAlgo = algo;
+ }
+
+ /**
+ * Get the canonicalization method.
+ *
+ * If the canonicalization method was not set then Exclusive XML
+ * Canonicalization is used by default.
+ *
+ * @return The string describing the canonicalization algorithm.
+ */
+ public String getSigCanonicalization() {
+ return canonAlgo;
+ }
}
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java?view=diff&rev=441936&r1=441935&r2=441936
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java Sun Sep 10 03:18:15 2006
@@ -351,6 +351,22 @@
}
/**
+ * Append the EncryptedKey element to the elements already in the Security
+ * header.
+ *
+ * The method can be called any time after <code>prepare()</code>. This
+ * allows to insert the EncryptedKey element at any position in the Security
+ * header.
+ *
+ * @param secHeader
+ * The security header that holds the Signature element.
+ */
+ public void appendToHeader(WSSecHeader secHeader) {
+ WSSecurityUtil.appendChildElement(document, secHeader
+ .getSecurityHeader(), encryptedKeyElement);
+ }
+
+ /**
* Prepend the BinarySecurityToken to the elements already in the Security
* header.
*
@@ -369,6 +385,24 @@
}
/**
+ * Append the BinarySecurityToken to the elements already in the Security
+ * header.
+ *
+ * The method can be called any time after <code>prepare()</code>. This
+ * allows to insert the BST element at any position in the Security header.
+ *
+ * @param secHeader
+ * The security header that holds the BST element.
+ */
+ public void appendBSTElementToHeader(WSSecHeader secHeader) {
+ if (bstToken != null) {
+ WSSecurityUtil.appendChildElement(document, secHeader
+ .getSecurityHeader(), bstToken.getElement());
+ }
+ bstToken = null;
+ }
+
+ /**
* @return Returns the ephemeralKey.
*/
public byte[] getEphemeralKey() {
@@ -424,5 +458,19 @@
*/
public void setEphemeralKey(byte[] ephemeralKey) {
this.ephemeralKey = ephemeralKey;
+ }
+
+ /**
+ * Get the id of the BSt generated during <code>prepare()</code>.
+ *
+ * @return Returns the the value of wsu:Id attribute of the
+ * BinaruSecurityToken element.
+ */
+ public String getBSTTokenId() {
+ if(this.bstToken == null) {
+ return null;
+ }
+
+ return this.bstToken.getID();
}
}
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java?view=diff&rev=441936&r1=441935&r2=441936
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java Sun Sep 10 03:18:15 2006
@@ -228,6 +228,20 @@
}
return sig.getId();
}
+
+ /**
+ * Get the id of the BSt generated during <code>prepare()</code>.
+ *
+ * @return Returns the the value of wsu:Id attribute of the
+ * BinaruSecurityToken element.
+ */
+ public String getBSTTokenId() {
+ if(this.bstToken == null) {
+ return null;
+ }
+
+ return this.bstToken.getID();
+ }
/**
* Initialize a WSSec Signature.
@@ -561,7 +575,23 @@
WSSecurityUtil.prependChildElement(document, secHeader.getSecurityHeader(), sig
.getElement(), false);
}
-
+
+ /**
+ * Appends the Signature element to the elements already in the Security
+ * header.
+ *
+ * The method can be called any time after <code>prepare()</code>.
+ * This allows to insert the Signature element at any position in the
+ * Security header.
+ *
+ * @param securityHeader
+ * The secHeader that holds the Signature element.
+ */
+ public void appendToHeader(WSSecHeader secHeader) {
+ WSSecurityUtil.appendChildElement(document, secHeader.getSecurityHeader(), sig
+ .getElement());
+ }
+
/**
* Prepend the BinarySecurityToken to the elements already in the Security
* header.
@@ -581,6 +611,14 @@
bstToken = null;
}
+ public void appendBSTElementToHeader(WSSecHeader secHeader) {
+ if (bstToken != null) {
+ WSSecurityUtil.appendChildElement(document, secHeader.getSecurityHeader(),
+ bstToken.getElement());
+ }
+ bstToken = null;
+ }
+
/**
* Compute the Signature over the references.
*
---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org