public class SigningXMLReader extends org.xml.sax.helpers.XMLFilterImpl
XMLReader
interface,
and may be used as such.
Normally, you obtain a SAX reader using a
SAXParserFactory
; if you
instead obtain a reader using the getXMLReader(File,String,String)
method, then it can be used in the same way as any other parser,
except that:
<?signature ...?>
processing
instruction in the input XML, then the signature will be checked,
and another <?signature ...?>
PI generated, with
information about the verification.In each case, further information can be retrieved about the
parse using the information object returned by
getGPGInformation(org.xml.sax.XMLReader)
.
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length) |
void |
endDocument() |
void |
endElement(String uri,
String localName,
String qName) |
void |
endPrefixMapping(String prefix) |
static GPGInformation |
getGPGInformation(XMLReader r)
Retrieves extra information about the work done by the
SigningXMLReader which is passed as argument.
|
static XMLReader |
getXMLReader(File gpgHome)
Obtains a new XMLreader which can verify input XML.
|
static XMLReader |
getXMLReader(File gpgHome,
String identity,
String passphrase)
Obtains a new XMLReader which can either sign or verify input
XML.
|
static XMLFilter |
getXMLReader(File gpgHome,
String identity,
String passphrase,
XMLReader xmlReader)
Wraps an existing reader in a SigningXMLReader.
|
void |
ignorableWhitespace(char[] ch,
int start,
int length) |
void |
parse(InputSource is) |
void |
processingInstruction(String target,
String data) |
void |
setDocumentLocator(Locator locator) |
void |
skippedEntity(String name) |
void |
startDocument() |
void |
startElement(String uri,
String localName,
String qName,
Attributes atts) |
void |
startPrefixMapping(String prefix,
String uri) |
error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, notationDecl, parse, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, unparsedEntityDecl, warning
public static GPGInformation getGPGInformation(XMLReader r)
r
- an XMLReader, typically a SigningXMLReaderpublic static XMLReader getXMLReader(File gpgHome) throws SAXException
getXMLReader(gpgHome, null, null)
SAXException
public static XMLReader getXMLReader(File gpgHome, String identity, String passphrase) throws SAXException
The gpgHome
parameter indicates the location of
the GPG keys to be used -- it is equivalent to, and overrides,
the environment variable GNUPGHOME
. It may be
null
to use the default location.
gpgHome
- the location of the GPG keys to be used, or nullidentity
- the GPG identity to use to sign keys, or nullpassphrase
- the passphrase for the key associated with
the identity, or nullSAXException
public static XMLFilter getXMLReader(File gpgHome, String identity, String passphrase, XMLReader xmlReader) throws SAXException
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ignorableWhitespace
in interface ContentHandler
ignorableWhitespace
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void processingInstruction(String target, String data) throws SAXException
processingInstruction
in interface ContentHandler
processingInstruction
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class org.xml.sax.helpers.XMLFilterImpl
public void skippedEntity(String name) throws SAXException
skippedEntity
in interface ContentHandler
skippedEntity
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
endDocument
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void parse(InputSource is) throws SAXException, IOException
parse
in interface XMLReader
parse
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
IOException
Copyright © 2014. All rights reserved.