|
From: <bob...@us...> - 2003-08-20 11:02:54
|
Update of /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/pki
In directory sc8-pr-cvs1:/tmp/cvs-serv16393/hk/hku/cecid/phoenix/pki
Modified Files:
ApacheXMLDSigner.java
Log Message:
add sign(tring username, char[] password, String keyStoreLocation,
String algorithm, String digestAlgorithm,
boolean signEnvelopeOnly)
on EbxmlMessage, which allow the user to sign the envelope only,
and specify the digest algorithm.
Index: ApacheXMLDSigner.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/pki/ApacheXMLDSigner.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ApacheXMLDSigner.java 16 Jul 2003 09:00:15 -0000 1.10
--- ApacheXMLDSigner.java 20 Aug 2003 08:02:10 -0000 1.11
***************
*** 213,216 ****
--- 213,217 ----
private Object obj;
+ private String digestAlgo;
/**
* Default constructor to initialize the internal variables.
***************
*** 223,226 ****
--- 224,228 ----
certResolver = null;
obj = null;
+ digestAlgo = null;
}
***************
*** 235,238 ****
--- 237,261 ----
* two values are tested: <code>dsa-sha1</code> and
* <code>rsa-sha1</code>.
+ * @param digestAlgo the algorithm used for making digest value. Currently,
+ * one value is supported: <code>sha1</code>
+ * @throws SignException internal exception when doing initialization
+ * on Apache XML Security library
+ */
+ public void setEnvelope(Document doc, String algo, String digestAlgo)
+ throws SignException {
+ setEnvelope(doc, algo);
+ this.digestAlgo = digestAlgo;
+ }
+
+ /**
+ * Set the envelope to host the Signature element. That is the
+ * XML document where the Signature element to be added. The
+ * digital signature here will always be an enveloped signature.
+ * The envelope will be included in the process of signing.
+ *
+ * @param doc the XML document to host the Signature element
+ * @param algo the algorithm used for digital signature. Currently, only
+ * two values are tested: <code>dsa-sha1</code> and
+ * <code>rsa-sha1</code>.
* @throws SignException internal exception when doing initialization
* on Apache XML Security library
***************
*** 338,342 ****
try {
! signature.addDocument("", transforms, DIGEST_METHOD);
}
catch (XMLSignatureException e) {
--- 361,370 ----
try {
! if (digestAlgo == null) {
! signature.addDocument("", transforms, DIGEST_METHOD);
! } else {
! signature.addDocument("", transforms,
! NAMESPACE_URI_DS + digestAlgo);
! }
}
catch (XMLSignatureException e) {
|