public abstract class Descriptor
extends oracle.security.xmlsec.util.XMLElement
| Modifier | Constructor and Description |
|---|---|
protected |
Descriptor(org.w3c.dom.Document owner,
java.lang.String nsURI,
java.lang.String localName)
Creates a new
Descriptor instance. |
|
Descriptor(org.w3c.dom.Element element)
Creates a new
Descriptor instance from the given Element node. |
|
Descriptor(org.w3c.dom.Element element,
java.lang.String systemId)
Creates a new
Descriptor instance from the given Element node. |
| Modifier and Type | Method and Description |
|---|---|
XSSignature |
addSignature(java.lang.String signatureMethod,
java.lang.String c14nMethod)
Creates a new XML-DSIG
Signature element and inserts it into this
message, replacing any exisiting XML-DSIG Signature element. |
XSSignature |
addSignature(java.lang.String signatureMethod,
java.lang.String c14nMethod,
java.lang.String digestMethod)
Creates a new XML-DSIG
Signature element and inserts it into this
message, replacing any exisiting XML-DSIG Signature element. |
protected void |
clearSignature()
Removes any exisiting XML-DSIG
Signature elements from this message. |
java.lang.String |
getCacheDuration()
Returns the cache duration.
|
Extensions |
getExtensions()
Returns the metadata extensions.
|
java.lang.String |
getID()
Returns the ID attribute.
|
XSSignature |
getSignature()
Returns the XML Signature child element from this element.
|
java.util.Date |
getValidUntil()
Returns the time until which the assertion is valid.
|
boolean |
isSigned()
Indicates if this element was signed.
|
void |
setCacheDuration(java.lang.String duration)
Sets the cache duration.
|
void |
setExtensions(Extensions extension)
Sets the metadata extension.
|
void |
setID(java.lang.String id)
Sets the ID attribute.
|
void |
setValidUntil(java.util.Date validUntil)
Sets the time until which this message is valid.
|
void |
sign(java.security.PrivateKey privateKey,
java.security.cert.X509Certificate cert)
Signs this
SAMLMessage with the given private key, and includes
the given certificate in the KeyInfo child element of the resulting
XML-DSIG Signature element. |
void |
sign(java.security.PrivateKey privateKey,
java.security.cert.X509Certificate cert,
java.lang.String c14nMethod)
Signs this
SAMLMessage with the given private key, and includes
the given certificate in the KeyInfo child element of the resulting
XML-DSIG Signature element. |
boolean |
verify()
Verifies the signature using a key obtained either from the KeyInfo element
(if any is present) or via the
oracle.security.xmlsec.keys.retrieval.KeyRetriever
mechanism. |
boolean |
verify(java.security.PublicKey publicKey)
Verifies the signature with the given public key.
|
addNSPrefixAttr, addNSPrefixAttr, addNSPrefixAttrDefault, addNSPrefixAttrDefault, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getChildElementsByTagName, getChildElementsByTagName, getChildElementsByTagNameNS, getChildElementsByTagNameNS, getDefaultNSPrefix, getElement, getElementsByTagName, getElementsByTagNameNS, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setDefaultNSPrefixappendChild, appendChild, appendTo, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNode, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getSystemId, hasAttributes, hasChildNodes, insertBefore, insertBefore, isSupported, normalize, removeChild, removeChild, replaceChild, replaceChild, setNodeValue, setPrefix, setSystemId, toBytesXML, toStringXMLpublic Descriptor(org.w3c.dom.Element element)
throws org.w3c.dom.DOMException
Descriptor instance from the given Element node.element - An Descriptor element.org.w3c.dom.DOMExceptionpublic Descriptor(org.w3c.dom.Element element,
java.lang.String systemId)
throws org.w3c.dom.DOMException
Descriptor instance from the given Element node.element - An Descriptor element.systemId - The URI string system ID for the Descriptor.org.w3c.dom.DOMExceptionprotected Descriptor(org.w3c.dom.Document owner,
java.lang.String nsURI,
java.lang.String localName)
throws org.w3c.dom.DOMException
Descriptor instance. This constructor
is for use in subclass for extension of the Descriptor element.owner - The owner document of the new Descriptor.nsURI - The namespace URI in which the new Descriptor is to be created.localName - The localName of the element represented by the class that extends this class.org.w3c.dom.DOMExceptionpublic void setID(java.lang.String id)
id - A unique identifier String.public java.lang.String getID()
null if none was found.public void setValidUntil(java.util.Date validUntil)
validUntil - The time instant.public java.util.Date getValidUntil()
Date indicating the time instant or null if none was found.public void setCacheDuration(java.lang.String duration)
duration - A ISO 8601 duration String.public java.lang.String getCacheDuration()
null if none has been set.public void setExtensions(Extensions extension)
extension - An Extensions object.public Extensions getExtensions()
Extension object or null if none has been set.public XSSignature getSignature()
XSSignature object or null if no signature is present.public boolean isSigned()
true if a signature is present or false otherwise.public void sign(java.security.PrivateKey privateKey,
java.security.cert.X509Certificate cert)
throws SigningException
SAMLMessage with the given private key, and includes
the given certificate in the KeyInfo child element of the resulting
XML-DSIG Signature element. The default canonicalization method is
XML-EXCLUSIVE-C14N.privateKey - The private key to use for the signature computation.cert - The X509 certificate corresponding to the private key.SigningExceptionpublic void sign(java.security.PrivateKey privateKey,
java.security.cert.X509Certificate cert,
java.lang.String c14nMethod)
throws SigningException
SAMLMessage with the given private key, and includes
the given certificate in the KeyInfo child element of the resulting
XML-DSIG Signature element.privateKey - The private key to use for the signature computation.cert - The X509 certificate corresponding to the private key.c14nMethod - The URI identifying the canonicalization method to be applied
to the SignedInfo structure.SigningExceptionpublic XSSignature addSignature(java.lang.String signatureMethod, java.lang.String c14nMethod)
Signature element and inserts it into this
message, replacing any exisiting XML-DSIG Signature element. The
default message digest algorithm is SHA-1.
Note: This method does not compute the SignatureValue or create
a KeyInfo child element for the Signature element so,
at a minimum, one of the sign() methods must be invoked on the
returned XSSignature object.
This method is intended for use by developers who need to customize the
Signature element (e.g., add custom Transform elements)
the computation of the SignatureValue (e.g., using an HMAC signature
algorithm) or the KeyInfo element. For most developers, either the
#sign(PrivateKey, X509) or #sign(PrivateKey, X509, String) method
should be sufficient.
signatureMethod - The value of the Algorithm attribute of the
SignatureMethod element contained within the new Signature element's SignedInfo
child element (e.g., oracle.security.xmlsec.util.XMLURI.alg_rsaWithSHA1).c14nMethod - The value of the Algorithm attribute of the
CanonicalizationMethod element contained within
the new Signature element's SignedInfo
child element (e.g., oracle.security.xmlsec.util.XMLURI.alg_c14nWithComments).oracle.security.xmlsec.dsig.XSSignature object.public XSSignature addSignature(java.lang.String signatureMethod, java.lang.String c14nMethod, java.lang.String digestMethod)
Signature element and inserts it into this
message, replacing any exisiting XML-DSIG Signature element.
Note: This method does not compute the SignatureValue or create
a KeyInfo child element for the Signature element so,
at a minimum, one of the sign() methods must be invoked on the
returned XSSignature object.
This method is intended for use by developers who need to customize the
Signature element (e.g., add custom Transform elements)
the computation of the SignatureValue (e.g., using an HMAC signature
algorithm) or the KeyInfo element. For most developers, either the
#sign(PrivateKey, X509) or #sign(PrivateKey, X509, String) method
should be sufficient.
signatureMethod - The value of the Algorithm attribute of the
SignatureMethod element contained within the
new Signature element's SignedInfo
child element (e.g., oracle.security.xmlsec.util.XMLURI.alg_rsaWithSHA1).c14nMethod - The value of the Algorithm attribute of the
CanonicalizationMethod element contained within
the new Signature element's SignedInfo
child element (e.g., oracle.security.xmlsec.util.XMLURI.alg_c14nWithComments).digestMethod - The value of the Algorithm attribute of the
DigestMethod element contained within
the new Signature element's Reference
child element (e.g., oracle.security.xmlsec.util.XMLURI.alg_sha1).oracle.security.xmlsec.dsig.XSSignature object.public boolean verify()
throws VerifyException
oracle.security.xmlsec.keys.retrieval.KeyRetriever
mechanism. Any Manifests referenced by the signature will be validated.true if the verification succeeded, or
false if the verification failed.VerifyException - If an error occurs while verifying the signature, or
if no signature is present in this message.public boolean verify(java.security.PublicKey publicKey)
throws VerifyException
publicKey - The public key used for verifying the signature.true if the verification succeeded, or
false if the verification failed.VerifyException - If an error occurs while verifying the signature, or
if no signature is present in this message.protected void clearSignature()
Signature elements from this message.