|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object anon.crypto.JAPCertificate
public final class JAPCertificate
This class represents an X509 certificate.
Nested Class Summary | |
---|---|
private static class |
JAPCertificate.X509CertificateGenerator
This class is used to create, duplicate and sign X509 certificates. |
private static class |
JAPCertificate.X509CertificateInstantiator
|
Field Summary | |
---|---|
private static java.lang.String |
BASE64_ALTERNATIVE_TAG
|
private static java.lang.String |
BASE64_TAG
|
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. |
private static java.lang.String |
DSA_WITH_SHA1
|
private static java.lang.String |
ECDSA_WITH_SHA1
|
private static java.lang.String |
IDENTIFIER_DSA_WITH_SHA1
SignatureAlgorithmIdentifiers and their names as specified by RFC 3279 |
private static java.lang.String |
IDENTIFIER_ECDSA_WITH_SHA1
|
private static java.lang.String |
IDENTIFIER_MD2_WITH_RSA_ENCRYPTION
|
private static java.lang.String |
IDENTIFIER_MD5_WITH_RSA_ENCRYPTION
|
private static java.lang.String |
IDENTIFIER_SHA1_WITH_RSA_ENCRYPTION
|
private org.bouncycastle.asn1.x509.X509CertificateStructure |
m_bcCertificate
|
private X509Extensions |
m_extensions
|
private java.lang.String |
m_id
|
private X509DistinguishedName |
m_issuer
|
private java.lang.String |
m_md5Fingerprint
|
private IMyPublicKey |
m_PubKey
|
private java.lang.String |
m_sha1Fingerprint
|
private X509DistinguishedName |
m_subject
|
private X509SubjectKeyIdentifier |
m_subjectKeyIdentifier
|
private Validity |
m_validity
|
private static java.lang.String |
MD2_WITH_RSA_ENCRYPTION
|
private static java.lang.String |
MD5_WITH_RSA_ENCRYPTION
|
private static IMyPrivateKey |
ms_dummyPrivateKey
The dummy private key is used to create temporary certificates. |
private static java.lang.String |
SHA1_WITH_RSA_ENCRYPTION
|
static java.lang.String |
XML_ELEMENT_CONTAINER_NAME
|
static java.lang.String |
XML_ELEMENT_NAME
|
Fields inherited from interface anon.util.IXMLEncodable |
---|
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION |
Constructor Summary | |
---|---|
private |
JAPCertificate(org.bouncycastle.asn1.x509.X509CertificateStructure x509cert)
Creates a new certificate from a valid X509 certificate structure. |
Method Summary | |
---|---|
static java.lang.String |
calculateXORofSKIs(java.util.Vector a_certificates)
|
java.lang.Object |
clone()
|
protected static java.lang.String |
createFingerprint(org.bouncycastle.crypto.digests.GeneralDigest a_digestGenerator,
byte[] a_data)
Creates a human readable fingerprint for this certificate. |
boolean |
equals(java.lang.Object a_certificate)
|
java.lang.String |
getAnyEmailAddress()
getAnyEmailAddress: checks all reasonably likely places in the certificate for an email address |
(package private) org.bouncycastle.asn1.DEREncodable |
getBouncyCastleCertificate()
|
(package private) org.bouncycastle.asn1.x509.SubjectPublicKeyInfo |
getBouncyCastleSubjectPublicKeyInfo()
|
private static IMyPrivateKey |
getDummyPrivateKey()
Gets a dummy private key for creating X509 certificates from trusted public keys. |
X509Extensions |
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(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(org.bouncycastle.asn1.x509.X509CertificateStructure x509cert)
Creates a new certificate from a valid X509 certificate structure. |
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,
X509Extensions 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,
X509Extensions 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. |
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 a the PKCS12 certificate. |
JAPCertificate |
sign(PKCS12 a_signerCertificate,
Validity a_validity,
X509Extensions 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. |
(package private) static org.bouncycastle.asn1.ASN1Sequence |
toASN1Sequence(byte[] a_bytes,
java.lang.String a_xmlElementName)
Converts a DER or BER encoded byte array into an ASN1 sequence. |
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. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
private static final java.lang.String BASE64_TAG
private static final java.lang.String BASE64_ALTERNATIVE_TAG
private static final java.lang.String IDENTIFIER_DSA_WITH_SHA1
private static final java.lang.String DSA_WITH_SHA1
private static final java.lang.String IDENTIFIER_MD2_WITH_RSA_ENCRYPTION
private static final java.lang.String MD2_WITH_RSA_ENCRYPTION
private static final java.lang.String IDENTIFIER_MD5_WITH_RSA_ENCRYPTION
private static final java.lang.String MD5_WITH_RSA_ENCRYPTION
private static final java.lang.String IDENTIFIER_SHA1_WITH_RSA_ENCRYPTION
private static final java.lang.String SHA1_WITH_RSA_ENCRYPTION
private static final java.lang.String IDENTIFIER_ECDSA_WITH_SHA1
private static final java.lang.String ECDSA_WITH_SHA1
private static IMyPrivateKey ms_dummyPrivateKey
private org.bouncycastle.asn1.x509.X509CertificateStructure m_bcCertificate
private X509DistinguishedName m_subject
private X509DistinguishedName m_issuer
private X509Extensions m_extensions
private X509SubjectKeyIdentifier m_subjectKeyIdentifier
private IMyPublicKey m_PubKey
private java.lang.String m_id
private java.lang.String m_sha1Fingerprint
private java.lang.String m_md5Fingerprint
private Validity m_validity
Constructor Detail |
---|
private JAPCertificate(org.bouncycastle.asn1.x509.X509CertificateStructure x509cert) throws java.lang.IllegalArgumentException
x509cert
- a valid X509 certificate structure
java.lang.IllegalArgumentException
- if the certificate structure is invalidMethod Detail |
---|
public static JAPCertificate getInstance(org.bouncycastle.asn1.x509.X509CertificateStructure x509cert)
x509cert
- a valid X509 certificate structure
public static JAPCertificate getInstance(JAPCertificate x509cert)
x509cert
- a valid X509 certificate
public static JAPCertificate getInstance(byte[] a_certificate)
a_certificate
- Byte Array of the Certificate
public 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, too
public static JAPCertificate getInstance(java.io.InputStream a_in)
a_in
- Inputstream that holds the certificate
public 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 certificate
public static JAPCertificate getInstance(java.lang.String a_certString)
a_strFileName
- Name of File that holds the certificate
public 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 certificate
public static JAPCertificate getInstance(X509DistinguishedName a_ownerAlias, AsymmetricCryptoKeyPair a_keyPair, Validity a_validity, X509Extensions 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 X509Extensions 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 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 OutputStream
java.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 certificate
public boolean verify(IMyPublicKey a_publicKey)
a_publicKey
- given public key
public JAPCertificate sign(PKCS12 a_signerCertificate)
a_signerCertificate
- the PKCS12 certificate of the signer
public JAPCertificate sign(PKCS12 a_signerCertificate, Validity a_validity, X509Extensions 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, X509Extensions 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.
org.bouncycastle.asn1.DEREncodable getBouncyCastleCertificate()
org.bouncycastle.asn1.x509.SubjectPublicKeyInfo getBouncyCastleSubjectPublicKeyInfo()
static org.bouncycastle.asn1.ASN1Sequence toASN1Sequence(byte[] a_bytes, java.lang.String a_xmlElementName)
a_bytes
- an array of bytesa_xmlElementName
- the name of the containing XML element or null if the object is not
expected to be in an XML element
protected static java.lang.String createFingerprint(org.bouncycastle.crypto.digests.GeneralDigest a_digestGenerator, byte[] a_data)
a_digestGenerator
- a digest generatora_data
- the data to be 'fingerprinted'
private static IMyPrivateKey getDummyPrivateKey()
public boolean isSelfSigned()
true
if this cert is self-signed.
public boolean isRevoked()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |