|
|||||||||
| Home >> All >> hk >> hku >> cecid >> phoenix >> [ pki overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
hk.hku.cecid.phoenix.pki
Class ApacheXMLDSigner

java.lang.Objecthk.hku.cecid.phoenix.pki.ApacheXMLDSigner
- All Implemented Interfaces:
- XMLDSigner
- public class ApacheXMLDSigner
- extends java.lang.Object
- implements XMLDSigner
- extends java.lang.Object
This class hides the details for digital signature. The digital signature routines are provided by the Apache XML Security library. We defined a standard way to have the document signed as interface. Different classes will implement the interface using different library behind.
- Version:
- $Revision: 1.8 $
| Field Summary | |
protected java.util.ArrayList |
documents
Internal variable for holding the documents needed to be referred in the signature. |
protected static java.lang.String |
DSIG_URI
The prefix of XML digital signature element. |
protected org.w3c.dom.Document |
envelope
Internal variable for holding the envelope of the signature. |
protected static hk.hku.cecid.phoenix.common.util.Logger |
logger
Logger |
protected XMLSignature |
signature
Internal variable of the Apache XML Security library signature object for doing the actual signing/verifying algorithm. |
protected CompositeKeyStore |
trusted
Internal variable for holding the trusted anchor for certificate path verification. |
| Constructor Summary | |
ApacheXMLDSigner()
Default constructor to initialize the internal variables. |
|
| Method Summary | |
void |
addDocument(java.lang.String uri,
java.io.InputStream is,
java.lang.String contentType)
Adds a reference to a document attachment to the signature. |
org.w3c.dom.Element |
getElement()
Gets the DOM element of the signature generated. |
void |
setEnvelope(org.w3c.dom.Document doc)
Set the envelope to host the Signature element. |
void |
setEnvelope(org.w3c.dom.Document doc,
java.lang.String algo)
Set the envelope to host the Signature element. |
void |
setTrustAnchor(CompositeKeyStore ks)
Sets the trust anchor for verfication of certificate path. |
void |
sign(CompositeKeyStore ks,
java.lang.String alias,
char[] password)
Signs the envelope and documents by using the specified key in the keystore. |
boolean |
verify()
Verifies the signature in the envelope passed in, which may reference the documents specified using the addDocument method. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
logger
protected static hk.hku.cecid.phoenix.common.util.Logger logger
- Logger
DSIG_URI
protected static final java.lang.String DSIG_URI
- The prefix of XML digital signature element.
- See Also:
- Constant Field Values
envelope
protected org.w3c.dom.Document envelope
- Internal variable for holding the envelope of the signature.
documents
protected java.util.ArrayList documents
- Internal variable for holding the documents needed to be referred
in the signature.
trusted
protected CompositeKeyStore trusted
- Internal variable for holding the trusted anchor for certificate
path verification.
signature
protected XMLSignature signature
- Internal variable of the Apache XML Security library signature object
for doing the actual signing/verifying algorithm.
| Constructor Detail |
ApacheXMLDSigner
public ApacheXMLDSigner()
- Default constructor to initialize the internal variables.
| Method Detail |
setEnvelope
public void setEnvelope(org.w3c.dom.Document doc, java.lang.String algo) throws SignException
- 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.
setEnvelope
public void setEnvelope(org.w3c.dom.Document doc) throws SignException
- 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.
- Specified by:
setEnvelopein interfaceXMLDSigner
addDocument
public void addDocument(java.lang.String uri, java.io.InputStream is, java.lang.String contentType)
- Adds a reference to a document attachment to the signature.
- Specified by:
addDocumentin interfaceXMLDSigner
sign
public void sign(CompositeKeyStore ks, java.lang.String alias, char[] password) throws SignException
- Signs the envelope and documents by using the specified key
in the keystore.
- Specified by:
signin interfaceXMLDSigner
setTrustAnchor
public void setTrustAnchor(CompositeKeyStore ks)
- Sets the trust anchor for verfication of certificate path.
- Specified by:
setTrustAnchorin interfaceXMLDSigner
verify
public boolean verify()
throws VerifyException
- Verifies the signature in the envelope passed in, which may reference
the documents specified using the addDocument method.
- Specified by:
verifyin interfaceXMLDSigner
getElement
public org.w3c.dom.Element getElement()
- Gets the DOM element of the signature generated.
- Specified by:
getElementin interfaceXMLDSigner
|
|||||||||
| Home >> All >> hk >> hku >> cecid >> phoenix >> [ pki overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
hk.hku.cecid.phoenix.pki.ApacheXMLDSigner