public class XML extends Object
Constructor and Description |
---|
XML() |
Modifier and Type | Method and Description |
---|---|
static Document |
getDocument(File file)
Parse an XML file to DOM
|
static Document |
getDocument(InputStream stream)
Parse an XML coming from an input stream to DOM
|
static Document |
getDocument(String xml)
Parse an XML string content to DOM
|
static DocumentBuilder |
newDocumentBuilder() |
static DocumentBuilderFactory |
newDocumentBuilderFactory() |
static String |
serialize(Document document)
Serialize to XML String
|
static Document |
sign(Document document,
RSAPublicKey publicKey,
RSAPrivateKey privateKey)
Sign the XML document using xmldsig.
|
static boolean |
validSignature(Document document,
Key publicKey)
Check the xmldsig signature of the XML document.
|
public static DocumentBuilderFactory newDocumentBuilderFactory()
public static DocumentBuilder newDocumentBuilder()
public static String serialize(Document document)
document
- The DOM documentpublic static Document getDocument(File file)
public static Document getDocument(String xml)
public static Document getDocument(InputStream stream)
public static boolean validSignature(Document document, Key publicKey)
document
- the document to testpublicKey
- the public key corresponding to the key pair the document was signed withpublic static Document sign(Document document, RSAPublicKey publicKey, RSAPrivateKey privateKey)
document
- the document to sign; it will be modified by the method.publicKey
- the public key from the key pair to sign the document.privateKey
- the private key from the key pair to sign the document.Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly