public class KeyProviderImplX509Data extends java.lang.Object implements KeyProviderInterface
KeyProviderInterface for X509Data key information
hints.
X509Data key information hints according to the
XML Signature specification. The methods insertX509DataAt(iaik.ixsil.keyinfo.x509.X509Data, int), getX509DataAt(int) and
removeX509DataAt(int) can be used for this purpose.
setTrustManager(iaik.ixsil.keyinfo.x509.X509TrustManagerInterface). If no trust management
system has been set, an instance of the default trust management system specified by the IXSIL
keymananger property KeyProviderImplX509Data.X509TrustManagerDefaultImplementingClass
will be created at first invocation of method getVerifierKey().
The X509Data key information hints will be processed according to the following algorithm to find out a trusted certificate and further to get the verification key for the signature:
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
JCA_CERTTYPE_X509_
The name to generate a certificate factory for X509 certificates in the Java Cryptography Architecture.
|
protected org.w3c.dom.Document |
signatureDOMDoc_
Reference to the Signature DOM document.
|
protected X509TrustManagerInterface |
trustManager_
The implementation of the trust management system interface
X509TrustManagerInterface. |
protected java.util.Vector |
x509Data_
Contains the result of parsing all specified X509Data DOM elements.
|
| Constructor and Description |
|---|
KeyProviderImplX509Data()
This constructor will be used by IXSIL in the verification use case.
|
KeyProviderImplX509Data(org.w3c.dom.Document signatureDOMDoc)
This constructor can be used by the application in the signature creation use case in order to create a
new key provider for
X509Data key information hints. |
| Modifier and Type | Method and Description |
|---|---|
protected org.w3c.dom.Element |
createX509CertificateDOMElem(java.security.cert.X509Certificate x509Certificate)
Creates a X509Certificate DOM element from a corresponding object.
|
protected org.w3c.dom.Element |
createX509CRLDOMElem(java.security.cert.X509CRL x509CRL)
Creates a X509CRL DOM element from a corresponding object.
|
protected org.w3c.dom.Element |
createX509IssuerSerialDOMElem(X509IssuerSerial x509IssuerSerial)
Creates a X509IssuerSerial DOM element from a corresponding object.
|
protected org.w3c.dom.Element |
createX509SKIDOMElem(X509SKI x509SKI)
Creates a X509SKI DOM element from a corresponding object.
|
protected org.w3c.dom.Element |
createX509SubjectNameDOMElem(X509SubjectName x509SubjectName)
Creates a X509SubjectName DOM element from a corresponding object.
|
org.w3c.dom.Element[] |
getKeyInfoSubelements()
Produces an array of X509Data DOM elements representing the key information hints specified by the
application by means of the method
insertX509DataAt(iaik.ixsil.keyinfo.x509.X509Data, int). |
java.security.Key |
getVerifierKey()
Gets the verification key by evaluating the parsed key information which has either been generated at
execution of method
setKeyInfoSubelements(org.w3c.dom.Element[]) or explicitely set by the application. |
X509Data |
getX509DataAt(int position)
Gets the
X509Data key information hint at the specified position from the list of hints which
have been inserted so far. |
int |
getX509DataNumber()
Gets the number of
X509Data key information hints inserted so far. |
X509Data |
insertX509DataAt(X509Data data,
int position)
Inserts a
X509Data key information hint at the specified position. |
boolean |
isEndEntityCertificate(java.security.cert.X509Certificate candidate,
java.security.cert.X509Certificate[] context)
Checks if a specified certificate is an end entity (EE) certificate.
|
protected java.security.cert.X509Certificate |
parseX509Certificate(org.w3c.dom.Element x509CertificateDOMElem)
Parses a X509Certificate DOM element.
|
protected java.security.cert.X509CRL |
parseX509CRL(org.w3c.dom.Element x509CRLDOMElem)
Parses a X509CRL DOM element.
|
protected X509IssuerSerial |
parseX509IssuerSerial(org.w3c.dom.Element x509IssuerSerialDOMElem)
Parses a X509IssuerSerial DOM element.
|
protected X509SKI |
parseX509SKI(org.w3c.dom.Element x509SKIDOMElem)
Parses a X509SKI DOM element.
|
protected X509SubjectName |
parseX509SubjectName(org.w3c.dom.Element x509SubjectNameDOMElem)
Parses a X509SubjectName DOM element.
|
X509Data |
removeX509DataAt(int position)
Removes the
X509Data key information hint at the specified position from the list of hints
which have been inserted so far. |
void |
setKeyInfoSubelements(org.w3c.dom.Element[] x509DataElements)
Parses all specified X509Data DOM elements and produces an internal memory representation.
|
void |
setTrustManager(X509TrustManagerInterface trustManager)
This method can be used by the application in the verification use case to explicitely set the trust
management system which should be used to evaluate the X509 related key information in the signature.
|
void |
setURIResolverParameters(URIResolverParameters params)
Sets the parameters to be used by the key provider when resolving URIs.
|
protected static final java.lang.String JCA_CERTTYPE_X509_
protected java.util.Vector x509Data_
X509Data.protected org.w3c.dom.Document signatureDOMDoc_
getKeyInfoSubelements().protected X509TrustManagerInterface trustManager_
X509TrustManagerInterface.public KeyProviderImplX509Data()
public KeyProviderImplX509Data(org.w3c.dom.Document signatureDOMDoc)
X509Data key information hints.signatureDOMDoc - A reference to the DOM document representing the XML Signature. Used in method
getKeyInfoSubelements() to create DOM nodes.public void setTrustManager(X509TrustManagerInterface trustManager)
trustManager - the trust management system which should back this key provider. Must not be
null.public void setKeyInfoSubelements(org.w3c.dom.Element[] x509DataElements)
throws KeyProviderException
setKeyInfoSubelements in interface KeyProviderInterfacex509DataElements - The array of X509Data DOM Elements to be parsed. Must not be null,
but may be an empty array.KeyProviderException - if parsing the specified DOM elements fails for any reason.public org.w3c.dom.Element[] getKeyInfoSubelements()
throws KeyProviderException
insertX509DataAt(iaik.ixsil.keyinfo.x509.X509Data, int).getKeyInfoSubelements in interface KeyProviderInterfacenull, if no key information hints have been
specified.KeyProviderException - if the wrong constructor has been used, and therefore no DOM Document
has been specified for creation of DOM Nodes.public java.security.Key getVerifierKey()
throws KeyProviderException
setKeyInfoSubelements(org.w3c.dom.Element[]) or explicitely set by the application.getVerifierKey in interface KeyProviderInterfaceKeyProviderException - if no trust manager has been set explicitely, and the default trust
manager cannot be instantiated; or if the trust manager reports an
error if one of its methods is invoked, or if no trusted verification
key can be found.public X509Data insertX509DataAt(X509Data data, int position) throws KeyProviderException
X509Data key information hint at the specified position.data - The X509Data key information hint to be inserted. Must not be null,
and must consist of at least one certificate hint.position - The position where to insert the key information in the list with the hints which have
been inserted so far. Must not be less than 0 and must not be greater than the number
of hints inserted so far.null if the specified position is invalid.KeyProviderException - if there are no certificate hints in the X509Data object.public X509Data getX509DataAt(int position)
X509Data key information hint at the specified position from the list of hints which
have been inserted so far.position - The position of the key information hint to get. Must not be less than 0 and must not
be greater than or equal the number of hints inserted so far.X509Data key information hint at the specified position or null if the
specified position is invalid.public X509Data removeX509DataAt(int position)
X509Data key information hint at the specified position from the list of hints
which have been inserted so far.position - The position of the key information hint to get. Must not be less than 0 and must not
be greater than or equal the number of hints inserted so far.X509Data key information hint which has been removed or null if the
specified position is invalid.public int getX509DataNumber()
X509Data key information hints inserted so far.X509Data key information hints inserted so far.public void setURIResolverParameters(URIResolverParameters params)
setURIResolverParameters in interface KeyProviderInterfaceparams - The parameters to be set. May be null to indicate a restore of the default
values.protected java.security.cert.X509CRL parseX509CRL(org.w3c.dom.Element x509CRLDOMElem)
throws KeyProviderException
x509CRLDOMElem - The DOM element to be parsed.X509CRL object generated from the parsed information.KeyProviderException - if parsing the X509CRL DOM element fails.protected java.security.cert.X509Certificate parseX509Certificate(org.w3c.dom.Element x509CertificateDOMElem)
throws KeyProviderException
x509CertificateDOMElem - The DOM element to be parsed.X509Certificate object generated from the parsed
information.KeyProviderException - if parsing the X509Certificate DOM element fails.protected X509IssuerSerial parseX509IssuerSerial(org.w3c.dom.Element x509IssuerSerialDOMElem) throws KeyProviderException
x509IssuerSerialDOMElem - The DOM element to be parsed.X509IssuerSerial object generated from the parsed information.KeyProviderException - if parsing the X509IssuerSerial DOM element fails.protected X509SKI parseX509SKI(org.w3c.dom.Element x509SKIDOMElem) throws KeyProviderException
x509SKIDOMElem - The DOM element to be parsed.X509SKI object generated from the parsed information.KeyProviderException - if parsing the X509SKI DOM element fails.protected X509SubjectName parseX509SubjectName(org.w3c.dom.Element x509SubjectNameDOMElem) throws KeyProviderException
x509SubjectNameDOMElem - The DOM element to be parsed.X509SubjectName object generated from the parsed information.KeyProviderException - if parsing the X509SubjectName DOM element fails.protected org.w3c.dom.Element createX509CRLDOMElem(java.security.cert.X509CRL x509CRL)
x509CRL - The X509CRL object used to create the corresponding DOM element.protected org.w3c.dom.Element createX509CertificateDOMElem(java.security.cert.X509Certificate x509Certificate)
x509Certificate - The X509Certificate object used to create the corresponding DOM element.protected org.w3c.dom.Element createX509SKIDOMElem(X509SKI x509SKI)
x509SKI - The X509SKI object used to create the corresponding DOM element.protected org.w3c.dom.Element createX509IssuerSerialDOMElem(X509IssuerSerial x509IssuerSerial)
x509IssuerSerial - The X509IssuerSerial object used to create the corresponding DOM element.protected org.w3c.dom.Element createX509SubjectNameDOMElem(X509SubjectName x509SubjectName)
x509SubjectName - The X509SubjectName object used to create the corresponding DOM element.public boolean isEndEntityCertificate(java.security.cert.X509Certificate candidate,
java.security.cert.X509Certificate[] context)
throws KeyProviderException
X509Certificate.isCertIssuingCaCert(iaik.x509.X509Certificate, boolean)
method which determines if the certificate is a CA certificate. If it is not a CA certificate, then
it must be an End-Entity certificate.candidate - The certificate to be checked.context - A bunch of certificates that should be used to find out if a certificate is the issuer
of another certificate (no longer used).true if the candidate certificate is an end entity certificate.KeyProviderException - if the check fails for any reason.