public final class JAPCertificate extends java.lang.Object implements IXMLEncodable, java.lang.Cloneable, ICertificate
Modifier and Type | Field and Description |
---|---|
static int |
CERTIFICATE_TYPE_INFOSERVICE
This is the certificate type constant for infoservice certificates.
|
static int |
CERTIFICATE_TYPE_MIX
This is the certificate type constant for mix certificates.
|
static int |
CERTIFICATE_TYPE_PAYMENT
Other certificate types
|
static int |
CERTIFICATE_TYPE_ROOT |
static int |
CERTIFICATE_TYPE_ROOT_INFOSERVICE |
static int |
CERTIFICATE_TYPE_ROOT_MIX
This are the certificate type constant for root certificates.
|
static int |
CERTIFICATE_TYPE_ROOT_PAYMENT |
static int |
CERTIFICATE_TYPE_ROOT_TERMS_AND_CONDITIONS |
static int |
CERTIFICATE_TYPE_ROOT_UPDATE |
static int |
CERTIFICATE_TYPE_TERMS_AND_CONDITIONS |
static int |
CERTIFICATE_TYPE_UPDATE
This is the certificate type constant for update certificates.
|
static java.lang.String |
XML_ELEMENT_CONTAINER_NAME |
static java.lang.String |
XML_ELEMENT_NAME |
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
calculateXORofSKIs(java.util.Vector a_certificates) |
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object a_certificate) |
java.lang.String |
getAnyEmailAddress()
getAnyEmailAddress: checks all reasonably likely places in the
certificate for an email address
|
MyX509Extensions |
getExtensions()
Returns the certificate's X509 extensions.
|
java.lang.String |
getId()
Returns a unique id for this certificate.
|
static JAPCertificate |
getInstance(byte[] a_certificate)
Creates a certificate instance by using the encoded variant of the
certificate.
|
static JAPCertificate |
getInstance(mybouncycastle.org.bouncycastle.asn1.x509.Certificate x509cert)
Creates a new certificate from a valid X509 certificate structure.
|
static JAPCertificate |
getInstance(java.io.File a_file)
Creates a certificate instance by using a file (either DER encoded or
PEM).
|
static JAPCertificate |
getInstance(IMyPublicKey a_publicKey,
java.util.Calendar a_validFrom)
Creates an X509 certificate with a short validity from a public key.
|
static JAPCertificate |
getInstance(java.io.InputStream a_in)
Creates a certificate by using an input stream.
|
static JAPCertificate |
getInstance(JAPCertificate x509cert)
Creates a new certificate from a valid X509 certificate.
|
static JAPCertificate |
getInstance(org.w3c.dom.Node a_NodeRoot)
Creates a certificate instance by using a XML Node as input.
|
static JAPCertificate |
getInstance(java.lang.String a_certString)
Creates a certificate instance by using a file name.
|
static java.util.Hashtable |
getInstance(java.lang.String a_strResourceSearchPath,
boolean a_bRecursive)
Instantiates all certificates found in the specified relative resource
path.
|
static java.util.Hashtable |
getInstance(java.lang.String a_strResourceSearchPath,
boolean a_bRecursive,
java.lang.String a_strIgnoreCertMark) |
static JAPCertificate |
getInstance(X509DistinguishedName a_ownerAlias,
AsymmetricCryptoKeyPair a_keyPair,
Validity a_validity)
Creates an X509 certificate from a key pair.
|
static JAPCertificate |
getInstance(X509DistinguishedName a_ownerAlias,
AsymmetricCryptoKeyPair a_keyPair,
Validity a_validity,
MyX509Extensions a_extensions)
Creates an X509 certificate from a key pair.
|
static JAPCertificate |
getInstance(X509DistinguishedName a_ownerAlias,
X509DistinguishedName a_issuer,
IMyPrivateKey a_privateKey,
IMyPublicKey a_publicKey,
Validity a_validity,
MyX509Extensions a_extensions,
java.math.BigInteger a_serialNumber)
Creates an X509 certificate.
|
X509DistinguishedName |
getIssuer() |
java.lang.String |
getMD5Fingerprint()
Gets a human readable MD5 fingerprint for this certificate.
|
IMyPublicKey |
getPublicKey()
Returns the public key of the certificate.
|
byte[] |
getRawSubjectKeyIdentifier()
Returns the byte representation of the X509SubjectKeyIdentifier
|
java.math.BigInteger |
getSerialNumber() |
java.lang.String |
getSHA1Fingerprint()
Gets a human readable SHA1 fingerprint for this certificate.
|
java.lang.String |
getSignatureAlgorithmName()
Converts the ObjectIdentifier from the certificate's signature algorithm
into its human-readable Name as specified by RFC 3279.
|
java.lang.String |
getSKEINFingerprint()
Gets a human readable SKEIN fingerprint for this certificate.
|
X509DistinguishedName |
getSubject()
Returns the distinguished name.
|
java.lang.String |
getSubjectKeyIdentifier()
Returns the String representation of the X509SubjectKeyIdentifier
|
java.lang.String |
getSubjectKeyIdentifierConcatenated() |
Validity |
getValidity()
Returns the validity period of this certificate.
|
JAPCertificate |
getX509Certificate()
Returns a reference to this certificate.
|
int |
hashCode()
The hash code is derived from the certificate`s id.
|
boolean |
isRevoked() |
boolean |
isSelfSigned()
Returns
true if this cert is self-signed. |
JAPCertificate |
sign(PKCS12 a_signerCertificate)
Creates a duplicate of this certificate that is signed with the PKCS12
certificate.
|
JAPCertificate |
sign(PKCS12 a_signerCertificate,
Validity a_validity,
MyX509Extensions a_extensions,
java.math.BigInteger a_serialNumber)
Creates a duplicate of this certificate that is signed with a the PKCS12
certificate.
|
void |
store(java.io.OutputStream a_ostream)
Writes this certificate to an output stream.
|
void |
store(java.io.OutputStream a_ostream,
boolean a_bBase64Encoded)
Writes this certificate to an output stream.
|
byte[] |
toByteArray()
Converts the certificate to a byte array.
|
byte[] |
toByteArray(boolean a_Base64Encoded)
Converts the certificate to a byte array.
|
org.w3c.dom.Element |
toXmlElement(org.w3c.dom.Document a_doc)
Creates XML element of certificate consisting of:
|
boolean |
verify(java.util.Enumeration a_verifyingCertificates)
Checks if a given Certificate could be directly verified against a set of
other certificates.
|
boolean |
verify(java.util.Hashtable a_verifyingCertificates)
Checks if a given Certificate could be directly verified against a set of
other certificates.
|
boolean |
verify(IMyPublicKey a_publicKey)
Verifies the certificate by using the public key.
|
boolean |
verify(JAPCertificate a_certificate)
Verifies the certificate using an other X509 certificate.
|
boolean |
verify(java.util.Vector a_verifyingCertificates)
Checks if a given Certificate could be directly verified against a set of
other certificates.
|
public static final int CERTIFICATE_TYPE_ROOT_MIX
public static final int CERTIFICATE_TYPE_ROOT_INFOSERVICE
public static final int CERTIFICATE_TYPE_ROOT_UPDATE
public static final int CERTIFICATE_TYPE_ROOT_PAYMENT
public static final int CERTIFICATE_TYPE_MIX
public static final int CERTIFICATE_TYPE_INFOSERVICE
public static final int CERTIFICATE_TYPE_UPDATE
public static final int CERTIFICATE_TYPE_PAYMENT
public static final int CERTIFICATE_TYPE_TERMS_AND_CONDITIONS
public static final int CERTIFICATE_TYPE_ROOT_TERMS_AND_CONDITIONS
public static final int CERTIFICATE_TYPE_ROOT
public static final java.lang.String XML_ELEMENT_NAME
public static final java.lang.String XML_ELEMENT_CONTAINER_NAME
public static JAPCertificate getInstance(mybouncycastle.org.bouncycastle.asn1.x509.Certificate x509cert)
x509cert
- a valid X509 certificate structurepublic static JAPCertificate getInstance(JAPCertificate x509cert)
x509cert
- a valid X509 certificatepublic static JAPCertificate getInstance(byte[] a_certificate)
a_certificate
- Byte Array of the Certificatepublic static java.util.Hashtable getInstance(java.lang.String a_strResourceSearchPath, boolean a_bRecursive, java.lang.String a_strIgnoreCertMark)
public static java.util.Hashtable getInstance(java.lang.String a_strResourceSearchPath, boolean a_bRecursive)
a_strResourceSearchPath
- a relative path to a resourcea_bRecursive
- if true subdirectories are searched, toopublic static JAPCertificate getInstance(java.io.InputStream a_in)
a_in
- Inputstream that holds the certificatepublic static JAPCertificate getInstance(org.w3c.dom.Node a_NodeRoot)
a_NodeRoot
- public static JAPCertificate getInstance(java.io.File a_file)
a_file
- File that holds the certificatepublic static JAPCertificate getInstance(java.lang.String a_certString)
a_strFileName
- Name of File that holds the certificatepublic static final JAPCertificate getInstance(IMyPublicKey a_publicKey, java.util.Calendar a_validFrom)
a_publicKey
- IMyPublicKeya_validFrom
- The date from which the certificate is valid.public static JAPCertificate getInstance(X509DistinguishedName a_ownerAlias, AsymmetricCryptoKeyPair a_keyPair, Validity a_validity)
a_ownerAlias
- The owner of the certificate.a_keyPair
- a key paira_validity
- the validity period of this certificatepublic static JAPCertificate getInstance(X509DistinguishedName a_ownerAlias, AsymmetricCryptoKeyPair a_keyPair, Validity a_validity, MyX509Extensions a_extensions)
a_ownerAlias
- The owner of the certificate.a_keyPair
- a key paira_validity
- the validity period of this certificatea_extensions
- some X509 extensions (may be null)public static java.lang.String calculateXORofSKIs(java.util.Vector a_certificates)
public boolean equals(java.lang.Object a_certificate)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String getId()
public IMyPublicKey getPublicKey()
getPublicKey
in interface ICertificate
public MyX509Extensions getExtensions()
public java.lang.String getSubjectKeyIdentifier()
public java.lang.String getSubjectKeyIdentifierConcatenated()
public byte[] getRawSubjectKeyIdentifier()
public java.lang.String getSignatureAlgorithmName()
public java.math.BigInteger getSerialNumber()
public X509DistinguishedName getIssuer()
public X509DistinguishedName getSubject()
public java.lang.String getAnyEmailAddress()
public JAPCertificate getX509Certificate()
getX509Certificate
in interface ICertificate
public java.lang.String getSHA1Fingerprint()
public java.lang.String getMD5Fingerprint()
public java.lang.String getSKEINFingerprint()
public byte[] toByteArray()
toByteArray
in interface ICertificate
java.io.IOException
public byte[] toByteArray(boolean a_Base64Encoded)
a_Base64Encoded
- if the certificate is converted to a Base64 encoded form.java.io.IOException
public void store(java.io.OutputStream a_ostream) throws java.io.IOException
a_ostream
- a OutputStreamjava.io.IOException
- if the certificate could not be written to the output streampublic void store(java.io.OutputStream a_ostream, boolean a_bBase64Encoded) throws java.io.IOException
a_ostream
- a OutputStreama_bBase64Encoded
- if the certificate should be written Base64 encoded.java.io.IOException
- if the certificate could not be written to the output streampublic Validity getValidity()
public boolean verify(java.util.Vector a_verifyingCertificates)
a_verifyingCertificates
- A Vector of JAPCertificates to verify this JAPCertificate.public boolean verify(java.util.Hashtable a_verifyingCertificates)
a_verifyingCertificates
- A Hashtable of JAPCertificates to verify this JAPCertificate.public boolean verify(java.util.Enumeration a_verifyingCertificates)
a_verifyingCertificates
- An Enumeration of JAPCertificates to verify this JAPCertificate.public boolean verify(JAPCertificate a_certificate)
a_certificate
- an X509 certificatepublic boolean verify(IMyPublicKey a_publicKey)
a_publicKey
- given public keypublic JAPCertificate sign(PKCS12 a_signerCertificate)
a_signerCertificate
- the PKCS12 certificate of the signerpublic JAPCertificate sign(PKCS12 a_signerCertificate, Validity a_validity, MyX509Extensions a_extensions, java.math.BigInteger a_serialNumber)
a_signerCertificate
- the PKCS12 certificate of the signera_validity
- the validity period of this certificatea_extensions
- some X509 extensions (may be null)a_serialNumber
- the serial number for this certificate (may be null)public static JAPCertificate getInstance(X509DistinguishedName a_ownerAlias, X509DistinguishedName a_issuer, IMyPrivateKey a_privateKey, IMyPublicKey a_publicKey, Validity a_validity, MyX509Extensions a_extensions, java.math.BigInteger a_serialNumber)
a_ownerAlias
- The owner of the certificate.a_issuer
- The issuer and signer of this X509 certificate.a_privateKey
- a private keya_publicKey
- a public keya_validity
- the validity period of this certificatea_extensions
- some X509 extensions (may be null)a_serialNumber
- the serial number for this certificate (may be null)public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
toXmlElement
in interface IXMLEncodable
a_doc
- The XML document, which is the environment for the created XML
element.public boolean isSelfSigned()
true
if this cert is self-signed.public boolean isRevoked()
Copyright © 2023. All rights reserved.