|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.XMLFilterImpl
uk.me.nxg.xoxa.SigningXMLReader
public class SigningXMLReader
An XML reader which can sign and verify XML in passing.
This is an implementation of the SAX
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,
which has an attribute
algorithm="http://ns.nxg.me.uk/xoxa/algo#openpgp"
,
then the signature will be checked,
and another <?signature ...?>
PI generated, with
information about the verification.algorithm
attribute
is missing or has a different value from the above, then the class
throws a XoxaException
.In each of the first two cases, further information can be
retrieved about the parse using the information object returned by
getGPGInformation(org.xml.sax.XMLReader)
.
Field Summary | |
---|---|
static String |
OPENPGP
|
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
|
void |
endDocument()
|
void |
endElement(String uri,
String localName,
String qName)
|
void |
endPrefixMapping(String prefix)
|
GPGInformation |
getGPGInformation()
Retrieves extra information about the work done by the XMLReader. |
static GPGInformation |
getGPGInformation(XMLReader r)
Retrieves extra information about the work done by the SigningXMLReader which is passed as argument. |
static XMLReader |
getXMLReader()
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)
|
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl |
---|
error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, notationDecl, parse, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String OPENPGP
Method Detail |
---|
public static GPGInformation getGPGInformation(XMLReader r)
r
- an XMLReader, typically a SigningXMLReader
public GPGInformation getGPGInformation()
public static XMLReader getXMLReader() throws SAXException
GNUPGHOME
.
Equivalent to getXMLReader(null, null, null)
SAXException
- on XML errorspublic 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 null
SAXException
- if SAX doespublic static XMLFilter getXMLReader(File gpgHome, String identity, String passphrase, XMLReader xmlReader) throws SAXException
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 nullxmlReader
- a XMLReader instance
SAXException
- if SAX doespublic 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |