background image

XML Digital Signature API Examples

<< Digital signature algorithm | Validating an XML Signature >>
<< Digital signature algorithm | Validating an XML Signature >>
XML D
IGITAL
S
IGNATURE
API E
XAMPLES
221
This
KeyInfo
element contains a
KeyValue
element, which in turn contains a
DSAKeyValue
element consisting of the public key needed to validate the signa-
ture.
KeyInfo
can contain various content such as X.509 certificates and PGP
key identifiers. See the
KeyInfo section
of the XML Signature Recommenda-
tion for more information on the different
KeyInfo
types.
XML Digital Signature API Examples
The following sections describe two examples that show how to use the XML
Digital Signature API:
· Validate example
· Signing example
To run the sample applications using the supplied Ant
build.xml
files, issue the
following commands after you installed Java WSDP:
For Solaris/Linux:
1. % export JWSDP_HOME=<your Java WSDP installation directory>
2. % export ANT_HOME=$JWSDP_HOME/apache-ant
3.
% export PATH=$ANT_HOME/bin:$PATH
4.
% cd $JWSDP_HOME/xmldsig/samples/<sample-name>
For Windows 2000/XP:
1.
> set JWSDP_HOME=<your Java WSDP installation directory>
2. > set ANT_HOME=%JWSDP_HOME%\apache-ant
3. > set PATH=%ANT_HOME%\bin;%PATH%
4. > cd %JWSDP_HOME%\xmldsig\samples\<sample-name>
validate Example
You can find the code shown in this section in the
Validate.java
file in the
<JWSDP_HOME>/xmldsig/samples/validate
directory. The file on which it
operates,
envelopedSignature.xml
, is in the same directory.
To run the example, execute the following command from the
<JWSDP_HOME>/
xmldsig/samples/validate
directory:
$ ant