|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.rsa.swsj.XMLSecurityOperation
com.rsa.swsj.signature.XMLSignature
This class builds and stores XML Signatures. XML Signatures are applied to arbitrary digital content data (data objects) via an indirection. Data objects are digested; the resulting value is placed in an element and that element is then digested and cryptographically signed. Enveloped or enveloping signatures are over data within the same XML document as the signature. Detached signatures are over data external to the signature element. XML digital signatures are represented by the Signature element which has the following structure.The following conventions are used:
?"+"*"
<Signature ID?>
<SignedInfo>
<CanonicalizationMethod/>
<SignatureMethod/>
(<Reference URI? >
(<Transforms>)?
<DigestMethod>
<DigestValue>
</Reference>)+
</SignedInfo>
<SignatureValue>
(<KeyInfo>)?
(<Object ID?>)*
</Signature> |
| Field Summary | |
static java.lang.String |
ALG_SIGNATURE_DSA_SHA1
Specifies the DSA signature algorithm. |
static java.lang.String |
ALG_SIGNATURE_HMAC_SHA1
Specifies that the MAC algorithm HMAC-SHA1 is used in XML Signature. |
static java.lang.String |
ALG_SIGNATURE_RSA_SHA1
Specifies the RSA signature algorithm. |
static int |
DETACHED
Specifies that the signature is detached. |
static int |
ENVELOPED
Specifies that the signature is enveloped. |
static int |
ENVELOPING
Specifies that the signature is enveloping. |
| Constructor Summary | |
XMLSignature(SWSJContext context)
Creates an empty |
|
XMLSignature(SWSJContext context,
java.lang.String reference,
java.security.PrivateKey privKey,
java.security.cert.X509Certificate cert,
java.security.cert.X509Certificate[] certChain)
Creates XMLSignature object set with all nessesary values. |
|
| Method Summary | |
void |
addManifest(java.lang.String id,
SigReference[] references)
Adds a manifest to the message and sets the references within that manifest. |
void |
addReference(Reference reference)
Adds a |
java.lang.String |
getCanonicalizationMethod()
Gets the canonicalization method. |
int |
getHMACOutputLen()
Gets the HMAC output length, in bits, as an integer. |
char[] |
getHMACPassword()
Gets the HMAC password used for signing and verification. |
java.lang.String |
getSignatureMethod()
Gets the signature method. |
byte[] |
getSignatureValue()
Gets the signature value as a |
int |
getType()
Gets the signature type as an integer value. |
void |
removeSignatureProperties()
Removes all the signature properties associated with this signature; if this method is called, <SignatureProperty> element that holds the signing time will not be created for this signature. |
void |
setCanonicalizationMethod(java.lang.String c14nMethod)
Sets the canonicalization method to c14nMethod. |
void |
setCertificates(java.security.cert.X509Certificate[] certificates)
Sets the array of known certificates to use when attempting to verify a signature. |
void |
setHMACOutputLen(int length)
Sets the HMAC output length, in bits, to the given value. |
void |
setHMACPassword(char[] password)
Sets the HMAC password to use for signing and verification. |
void |
setPrivateKey(java.security.PrivateKey privKey)
Sets the private key to use when signing. |
void |
setPublicKeys(java.security.PublicKey[] pubKeys)
Sets the array of known public keys to use when attempting to verifiy a signature. |
void |
setReferences(Reference[] references)
Sets the array of references. |
void |
setType(int type)
Sets the signature type to type. |
| Methods inherited from class com.rsa.swsj.XMLSecurityOperation |
getContext, getId, getNamespacePrefix, getOutputStream, getParameters, getReferences, getStatusInfo, getTimestamp, setExpirationTime, setId, setLocation, setNamespacePrefix, setOutputStream, setParameters, skip |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int DETACHED
public static final int ENVELOPING
public static final int ENVELOPED
public static final java.lang.String ALG_SIGNATURE_HMAC_SHA1
public static final java.lang.String ALG_SIGNATURE_DSA_SHA1
public static final java.lang.String ALG_SIGNATURE_RSA_SHA1
| Constructor Detail |
public XMLSignature(SWSJContext context)
throws InvalidParameterException
XMLSignature object initialized only with
a context. This constructor is the default constructor.
context - An object that collects a number of common parameters and
state variables; for example, JCE provider.
InvalidParameterException - If context is invalid.
public XMLSignature(SWSJContext context,
java.lang.String reference,
java.security.PrivateKey privKey,
java.security.cert.X509Certificate cert,
java.security.cert.X509Certificate[] certChain)
throws InvalidParameterException
context - An object that collects a number of common parameters and
state variables; for example, JCE provider.reference - The data to sign. By default no transform is
provided.privKey - The private key to use for signing.cert - A certificate containing the public key to verify the
signature. If null is passed, public key must be
passed later; otherwise, KeyInfo X509Data will be created.certChain - The list of certificates used to verify the
cert. If null is passed, the
certificates must be passed later or invoke
context.setCertValidator(null) explicitly to skip
the validation of the cert; otherwise, the passed certificates
are added to KeyInfo.
InvalidParameterException - If an invalid value is set.| Method Detail |
public void setType(int type)
throws InvalidParameterException
setType in class XMLSecurityOperationtype - An integer containing the value of the signature type,
defined in this class. The signature can be described as
detached, enveloping, or enveloped.
InvalidParameterException - If type is invalid.public int getType()
getType in class XMLSecurityOperationpublic void setHMACOutputLen(int length)
length - The integer value of the required HMAC output length, in
bits.public int getHMACOutputLen()
0 is returned.
public java.lang.String getSignatureMethod()
String.
public void setCanonicalizationMethod(java.lang.String c14nMethod)
throws InvalidParameterException
c14nMethod - The required element as a String defined
in the Reference class that specifies the
canonicalization algorithm applied to the
SignedInfo element prior to signature calculations.
InvalidParameterException - If c14nMethod is invalid.public java.lang.String getCanonicalizationMethod()
String that is
defined in the Reference class.public byte[] getSignatureValue()
byte array.
signatureValue of this
XMLSignature as a byte array.
public void addManifest(java.lang.String id,
SigReference[] references)
throws InvalidParameterException
id - An identifier for the new manifest.references - An array of signature references to set.
InvalidParameterException - If any parameter is invalid.
public void setHMACPassword(char[] password)
throws InvalidParameterException
WSSDocument objects, if a
UsernameToken object is set in the
WSSParameters the password set in that
UsernameToken object will be used as the HMAC password.
password - The HMAC Password.
InvalidParameterException - If password is invalid.public char[] getHMACPassword()
WSSDocument objects, if a
UsernameToken object is set in the
WSSParameters the password set in that
UsernameToken object will be used as the HMAC password.
public void setCertificates(java.security.cert.X509Certificate[] certificates)
XMLSecurityHandler.needPublicKeys() is invoked. This
operation does not report any errors.
certificates - An array of X509Certificates.public void setPublicKeys(java.security.PublicKey[] pubKeys)
XMLSecurityHandler.needPublicKeys() is invoked. This
operation does not report any errors.
pubKeys - An array of public keys.public void setPrivateKey(java.security.PrivateKey privKey)
privKey - The private key to use for signing.public void removeSignatureProperties()
public void addReference(Reference reference)
throws InvalidParameterException
SigReference.
addReference in class XMLSecurityOperationreference - The reference to add.
InvalidParameterException - If the reference is null.
public void setReferences(Reference[] references)
throws InvalidParameterException
setReferences in class XMLSecurityOperationreferences - An array of references.
InvalidParameterException - If the any of the references is
null.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||