public class XMLSignatureUtil extends Object
| Constructor and Description |
|---|
XMLSignatureUtil() |
| Modifier and Type | Method and Description |
|---|---|
static X509Certificate |
getX509CertificateFromKeyInfoString(String certificateString)
Given the X509Certificate in the keyinfo element, get a
X509Certificate |
static void |
marshall(Document signedDocument,
OutputStream os)
Marshall the signed document to an output stream
|
static void |
marshall(SignatureType signature,
OutputStream os)
Marshall a SignatureType to output stream
|
static boolean |
preCheckSignedInfo(Document doc)
Precheck whether the document that will be validated has the right signedinfo
|
static void |
setCanonicalizationMethodType(String canonical)
Set the canonicalization method type
|
static void |
setIncludeKeyInfoInSignature(boolean includeKeyInfoInSignature)
Use this method to not include the KeyInfo in the signature
|
static Document |
sign(Document doc,
KeyPair keyPair,
String digestMethod,
String signatureMethod,
String referenceURI)
Sign the root element
|
static Document |
sign(Document doc,
Node nodeToBeSigned,
KeyPair keyPair,
String digestMethod,
String signatureMethod,
String referenceURI)
Sign a node in a document
|
static Document |
sign(Document doc,
Node parentOfNodeToBeSigned,
PrivateKey signingKey,
X509Certificate certificate,
String digestMethod,
String signatureMethod,
String referenceURI)
Sign a node in a document
|
static Document |
sign(SignatureUtilTransferObject dto)
Sign the root element
|
static boolean |
validate(Document signedDoc,
Key publicKey)
Validate a signed document with the given public key
|
public static void setCanonicalizationMethodType(String canonical)
canonical - public static void setIncludeKeyInfoInSignature(boolean includeKeyInfoInSignature)
includeKeyInfoInSignature - public static boolean preCheckSignedInfo(Document doc)
doc - public static Document sign(Document doc, Node parentOfNodeToBeSigned, PrivateKey signingKey, X509Certificate certificate, String digestMethod, String signatureMethod, String referenceURI) throws ParserConfigurationException, GeneralSecurityException, MarshalException, XMLSignatureException
doc - DocumentparentOfNodeToBeSigned - Parent Node of the node to be signedsigningKey - Private Keycertificate - X509 Certificate holding the public keydigestMethod - (Example: DigestMethod.SHA1)signatureMethod - (Example: SignatureMethod.DSA_SHA1)referenceURI - XMLSignatureExceptionMarshalExceptionGeneralSecurityExceptionParserConfigurationExceptionpublic static Document sign(Document doc, Node nodeToBeSigned, KeyPair keyPair, String digestMethod, String signatureMethod, String referenceURI) throws ParserConfigurationException, GeneralSecurityException, MarshalException, XMLSignatureException
doc - nodeToBeSigned - keyPair - publicKey - digestMethod - signatureMethod - referenceURI - ParserConfigurationExceptionXMLSignatureExceptionMarshalExceptionGeneralSecurityExceptionpublic static Document sign(Document doc, KeyPair keyPair, String digestMethod, String signatureMethod, String referenceURI) throws GeneralSecurityException, MarshalException, XMLSignatureException
doc - signingKey - publicKey - digestMethod - signatureMethod - referenceURI - GeneralSecurityExceptionXMLSignatureExceptionMarshalExceptionpublic static Document sign(SignatureUtilTransferObject dto) throws GeneralSecurityException, MarshalException, XMLSignatureException
doc - signingKey - publicKey - digestMethod - signatureMethod - referenceURI - GeneralSecurityExceptionXMLSignatureExceptionMarshalExceptionpublic static boolean validate(Document signedDoc, Key publicKey) throws MarshalException, XMLSignatureException
signedDoc - publicKey - MarshalExceptionXMLSignatureExceptionpublic static void marshall(SignatureType signature, OutputStream os) throws JAXBException, SAXException
signature - os - SAXExceptionJAXBExceptionpublic static void marshall(Document signedDocument, OutputStream os) throws TransformerException
signedDocument - os - TransformerExceptionpublic static X509Certificate getX509CertificateFromKeyInfoString(String certificateString) throws ProcessingException
X509CertificatecertificateString - ProcessingExceptionCopyright © 2012 JBoss by Red Hat. All Rights Reserved.