public class SignatureVerifier extends java.lang.Object implements IXMLEncodable
Modifier and Type | Field and Description |
---|---|
static int |
DOCUMENT_CLASS_INFOSERVICE
This is the class for all documents coming from infoservices (infoserviceinfo).
|
static int |
DOCUMENT_CLASS_MIX
This is the class for all documents coming from mixes (mixinfo, cascadeinfo, status).
|
static int |
DOCUMENT_CLASS_NONE |
static int |
DOCUMENT_CLASS_PAYMENT |
static int |
DOCUMENT_CLASS_TERMS |
static int |
DOCUMENT_CLASS_UPDATE
This is the class for all documents with JAP update specific stuff (WebStart files,
minimal JAP version).
|
private boolean |
m_checkSignatures
Stores whether signature checking is enabled or disabled.
|
private java.util.Hashtable |
m_hashSignatureChecks
Stores whether signature checks for a document type are done or not.
|
private CertificateStore |
m_trustedCertificates
Stores all trusted certificates.
|
private static SignatureVerifier |
ms_svInstance
Stores the instance of SignatureVerifier (Singleton).
|
private static java.lang.String |
XML_ATTR_CHECK |
private static java.lang.String |
XML_ATTR_CLASS |
private static java.lang.String |
XML_DOCUMENT_CLASS |
static java.lang.String |
XML_ELEMENT_NAME
Stores the name of the root node of the XML settings for this class.
|
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
Modifier | Constructor and Description |
---|---|
private |
SignatureVerifier()
Creates a new instance of SignatureVerifier.
|
Modifier and Type | Method and Description |
---|---|
static SignatureVerifier |
getInstance()
Returns the instance of SignatureVerifier (Singleton).
|
CertificateStore |
getVerificationCertificateStore()
Returns the certificate store used for the verification of all signatures.
|
XMLSignature |
getVerifiedXml(org.w3c.dom.Element a_rootNode,
int a_documentClass)
Verifies the signature of an XML document against the store of trusted certificates.
|
static java.lang.String |
getXmlSettingsRootNodeName()
Returns the name of the XML node used to store all settings of the SignatureVerifier
instance.
|
boolean |
isCheckSignatures()
Returns whether signature verification is enabled or not.
|
boolean |
isCheckSignatures(int a_documentClass) |
void |
loadSettingsFromXml(org.w3c.dom.Element a_signatureVerificationNode) |
void |
loadSettingsFromXml(org.w3c.dom.Element a_signatureVerificationNode,
java.util.Hashtable a_ignoredDocClasses)
Restores the settings of this instance of SignatureVerifier with the settings stored in the
specified XML node.
|
void |
setCheckSignatures(boolean a_checkSignaturesEnabled)
Enables or disables the check of signatures.
|
void |
setCheckSignatures(int a_documentClass,
boolean a_bCheckignatures) |
org.w3c.dom.Element |
toXmlElement(org.w3c.dom.Document a_doc)
Returns all settings (including the verification certificate store) as an XML node.
|
boolean |
verifyXml(org.w3c.dom.Document a_rootNode,
int a_documentClass)
Verifies the signature of an XML document against the store of trusted certificates.
|
boolean |
verifyXml(org.w3c.dom.Element a_rootNode,
int a_documentClass)
Verifies the signature of an XML document against the store of trusted certificates.
|
public static final int DOCUMENT_CLASS_NONE
public static final int DOCUMENT_CLASS_MIX
public static final int DOCUMENT_CLASS_INFOSERVICE
public static final int DOCUMENT_CLASS_UPDATE
public static final int DOCUMENT_CLASS_PAYMENT
public static final int DOCUMENT_CLASS_TERMS
public static final java.lang.String XML_ELEMENT_NAME
private static final java.lang.String XML_ATTR_CHECK
private static final java.lang.String XML_DOCUMENT_CLASS
private static final java.lang.String XML_ATTR_CLASS
private static SignatureVerifier ms_svInstance
private java.util.Hashtable m_hashSignatureChecks
private CertificateStore m_trustedCertificates
private boolean m_checkSignatures
private SignatureVerifier()
public static SignatureVerifier getInstance()
public static java.lang.String getXmlSettingsRootNodeName()
public void setCheckSignatures(boolean a_checkSignaturesEnabled)
a_checkSignaturesEnabled
- True, if signature checking shall be enabled, false if it
shall be disabled.public void setCheckSignatures(int a_documentClass, boolean a_bCheckignatures)
public boolean isCheckSignatures(int a_documentClass)
public boolean isCheckSignatures()
public CertificateStore getVerificationCertificateStore()
public boolean verifyXml(org.w3c.dom.Document a_rootNode, int a_documentClass)
a_rootNode
- The root node of the document. The Signature node must be one of the
children of the root node.a_documentClass
- The class of the document. See the constants in this class.public boolean verifyXml(org.w3c.dom.Element a_rootNode, int a_documentClass)
a_rootNode
- The root node of the document. The Signature node must be one of the
children of the root node.a_documentClass
- The class of the document. See the constants in this class.public XMLSignature getVerifiedXml(org.w3c.dom.Element a_rootNode, int a_documentClass)
a_rootNode
- The root node of the document. The Signature node must be one of the
children of the root node.a_documentClass
- The class of the document. See the constants in this class.public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
toXmlElement
in interface IXMLEncodable
a_doc
- The parent document for the created XML node.public void loadSettingsFromXml(org.w3c.dom.Element a_signatureVerificationNode) throws java.lang.Exception
java.lang.Exception
public void loadSettingsFromXml(org.w3c.dom.Element a_signatureVerificationNode, java.util.Hashtable a_ignoredDocClasses) throws java.lang.Exception
a_signatureVerificationNode
- The XML node for loading the settings from. The name of
the needed XML node can be obtained by calling
getXmlSettingsRootNodeName().java.lang.Exception
Copyright © 2023. All rights reserved.