org.kde.koala

Class KSSLCertificate

public class KSSLCertificate extends Object implements QtSupport

KDE X.509 Certificate This class represents an X.509 (SSL) certificate. Note: this object is VERY HEAVY TO COPY. Please try to use reference or pointer whenever possible

Author: George Staikos

See Also: KSSL

UNKNOWN: KDE X.509 Certificate.

Field Summary
static intAny
static intErrorReadingRoot
static intExpired
static intInvalidCA
static intInvalidHost
static intInvalidPurpose
static intIrrelevant
static intNoCARoot
static intNone
static intNoSSL
static intOk
static intPathLengthExceeded
static intPrivateKeyFailed
static intRejected
static intRevoked
static intSelfSigned
static intSelfSignedChain
static intSignatureFailed
static intSMIMEEncrypt
static intSMIMESign
static intSSLClient
static intSSLServer
static intUnknown
A CA certificate can be validated as Irrelevant when it was not used to sign any other relevant certificate.
static intUntrusted
Constructor Summary
protected KSSLCertificate(Class dummy)
KSSLCertificate(KSSLCertificate x)
Copy constructor.
KSSLCertificate()
Method Summary
KSSLCertChainchain()
Get a reference to the certificate chain.
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
protected voidfinalize()
Deletes the wrapped C++ instance
static KSSLCertificatefromString(String cert)
Create an X.509 certificate from a base64 encoded string.
voidgetEmails(String[] to)
FIXME: document
StringgetIssuer()
Get the issuer of the certificate (X.509 map).
StringgetKDEKey()
KDEKey is a concatenation "Subject (MD5)", mostly needed for SMIME.
StringgetKeyType()
Get the key type (RSA, DSA, etc).
StringgetMD5Digest()
Get the MD5 digest of the certificate.
static StringgetMD5DigestFromKDEKey(String k)
Aegypten semantics force us to search by MD5Digest only.
StringgetMD5DigestText()
Get the MD5 digest of the certificate.
StringgetNotAfter()
Get the date that the certificate is valid until.
StringgetNotBefore()
Get the date that the certificate becomes valid on.
StringgetPublicKeyText()
Get the public key.
CalendargetQDTNotAfter()
Get the date that the certificate is valid until.
CalendargetQDTNotBefore()
Get the date that the certificate becomes valid on.
StringgetSerialNumber()
Get the serial number of the certificate.
StringgetSignatureText()
Get the signature.
StringgetSubject()
Get the subject of the certificate (X.509 map).
booleanisDisposed()
Has the wrapped C++ instance been deleted?
booleanisSigner()
Check if this is a signer certificate.
booleanisValid()
Check if this is a valid certificate.
booleanisValid(int p)
Check if this is a valid certificate.
protected intprocessError(int ec)
KSSLCertificatereplicate()
Explicitly make a copy of this certificate.
intrevalidate()
Check if this is a valid certificate.
intrevalidate(int p)
Check if this is a valid certificate.
booleansetCert(StringBuffer cert)
Re-set the certificate from a base64 string.
ArrayListsubjAltNames()
The alternate subject name.
byte[]toDer()
Convert the certificate to DER (ASN.1) format.
byte[]toNetscape()
Convert the certificate to Netscape format.
byte[]toPem()
Convert the certificate to PEM (base64) format.
StringtoString()
Convert this certificate to a string.
StringtoText()
Convert the certificate to OpenSSL plain text format.
intvalidate()
Check if this is a valid certificate.
intvalidate(int p)
Check if this is a valid certificate.
static StringverifyText(int x)
Obtain the localized message that corresponds to a validation result.
KSSLX509V3x509V3Extensions()
Access the X.509v3 parameters.

Field Detail

Any

public static final int Any

ErrorReadingRoot

public static final int ErrorReadingRoot

Expired

public static final int Expired

InvalidCA

public static final int InvalidCA

InvalidHost

public static final int InvalidHost

InvalidPurpose

public static final int InvalidPurpose

Irrelevant

public static final int Irrelevant

NoCARoot

public static final int NoCARoot

None

public static final int None

NoSSL

public static final int NoSSL

Ok

public static final int Ok

PathLengthExceeded

public static final int PathLengthExceeded

PrivateKeyFailed

public static final int PrivateKeyFailed

Rejected

public static final int Rejected

Revoked

public static final int Revoked

SelfSigned

public static final int SelfSigned

SelfSignedChain

public static final int SelfSignedChain

SignatureFailed

public static final int SignatureFailed

SMIMEEncrypt

public static final int SMIMEEncrypt

SMIMESign

public static final int SMIMESign

SSLClient

public static final int SSLClient

SSLServer

public static final int SSLServer

Unknown

public static final int Unknown
A CA certificate can be validated as Irrelevant when it was not used to sign any other relevant certificate.

UNKNOWN: A CA certificate can be validated as Irrelevant when it was not used to sign any other relevant certificate.

Untrusted

public static final int Untrusted

Constructor Detail

KSSLCertificate

protected KSSLCertificate(Class dummy)

KSSLCertificate

public KSSLCertificate(KSSLCertificate x)
Copy constructor. Beware, this is very expensive.

Parameters: x the object to copy from

UNKNOWN: Copy constructor.

KSSLCertificate

public KSSLCertificate()

Method Detail

chain

public KSSLCertChain chain()
Get a reference to the certificate chain.

Returns: reference to the chain

UNKNOWN: Get a reference to the certificate chain.

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()

finalize

protected void finalize()
Deletes the wrapped C++ instance

fromString

public static KSSLCertificate fromString(String cert)
Create an X.509 certificate from a base64 encoded string.

Parameters: cert the certificate in base64 form

Returns: the X.509 certificate, or NULL

UNKNOWN: Create an X.

getEmails

public void getEmails(String[] to)
FIXME: document

UNKNOWN: FIXME: document

getIssuer

public String getIssuer()
Get the issuer of the certificate (X.509 map).

Returns: the issuer

UNKNOWN: Get the issuer of the certificate (X.

getKDEKey

public String getKDEKey()
KDEKey is a concatenation "Subject (MD5)", mostly needed for SMIME. The result of getKDEKey might change and should not be used for persistant storage.

UNKNOWN: KDEKey is a concatenation "Subject (MD5)", mostly needed for SMIME.

getKeyType

public String getKeyType()
Get the key type (RSA, DSA, etc).

Returns: the key type as a string

UNKNOWN: Get the key type (RSA, DSA, etc).

getMD5Digest

public String getMD5Digest()
Get the MD5 digest of the certificate.

Returns: the MD5 digest in a hexidecimal string

UNKNOWN: Get the MD5 digest of the certificate.

getMD5DigestFromKDEKey

public static String getMD5DigestFromKDEKey(String k)
Aegypten semantics force us to search by MD5Digest only.

UNKNOWN: Aegypten semantics force us to search by MD5Digest only.

getMD5DigestText

public String getMD5DigestText()
Get the MD5 digest of the certificate. Result is padded with : to separate bytes - it's a text version!

Returns: the MD5 digest in a hexidecimal string

UNKNOWN: Get the MD5 digest of the certificate.

getNotAfter

public String getNotAfter()
Get the date that the certificate is valid until.

Returns: the date as a string, localised

UNKNOWN: Get the date that the certificate is valid until.

getNotBefore

public String getNotBefore()
Get the date that the certificate becomes valid on.

Returns: the date as a string, localised

UNKNOWN: Get the date that the certificate becomes valid on.

getPublicKeyText

public String getPublicKeyText()
Get the public key.

Returns: the public key as a hexidecimal string

UNKNOWN: Get the public key.

getQDTNotAfter

public Calendar getQDTNotAfter()
Get the date that the certificate is valid until.

Returns: the date

UNKNOWN: Get the date that the certificate is valid until.

getQDTNotBefore

public Calendar getQDTNotBefore()
Get the date that the certificate becomes valid on.

Returns: the date

UNKNOWN: Get the date that the certificate becomes valid on.

getSerialNumber

public String getSerialNumber()
Get the serial number of the certificate.

Returns: the serial number as a string

UNKNOWN: Get the serial number of the certificate.

getSignatureText

public String getSignatureText()
Get the signature.

Returns: the signature in text format

UNKNOWN: Get the signature.

getSubject

public String getSubject()
Get the subject of the certificate (X.509 map).

Returns: the subject

UNKNOWN: Get the subject of the certificate (X.

isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?

isSigner

public boolean isSigner()
Check if this is a signer certificate.

Returns: true if this is a signer certificate

UNKNOWN: Check if this is a signer certificate.

isValid

public boolean isValid()
Check if this is a valid certificate. Will use cached data.

Returns: true if it is valid

UNKNOWN: Check if this is a valid certificate.

isValid

public boolean isValid(int p)
Check if this is a valid certificate. Will use cached data.

Parameters: p the purpose to validate for

Returns: true if it is valid

UNKNOWN: Check if this is a valid certificate.

processError

protected int processError(int ec)

replicate

public KSSLCertificate replicate()
Explicitly make a copy of this certificate.

Returns: a copy of the certificate

UNKNOWN: Explicitly make a copy of this certificate.

revalidate

public int revalidate()
Check if this is a valid certificate. Will NOT use cached data.

Returns: the result of the validation

UNKNOWN: Check if this is a valid certificate.

revalidate

public int revalidate(int p)
Check if this is a valid certificate. Will NOT use cached data.

Parameters: p the purpose to validate for

Returns: the result of the validation

UNKNOWN: Check if this is a valid certificate.

setCert

public boolean setCert(StringBuffer cert)
Re-set the certificate from a base64 string.

Parameters: cert the certificate to set to

Returns: true on success

UNKNOWN: Re-set the certificate from a base64 string.

subjAltNames

public ArrayList subjAltNames()
The alternate subject name.

Returns: string list with subjectAltName

UNKNOWN: The alternate subject name.

toDer

public byte[] toDer()
Convert the certificate to DER (ASN.1) format.

Returns: the binary data of the DER encoding

UNKNOWN: Convert the certificate to DER (ASN.

toNetscape

public byte[] toNetscape()
Convert the certificate to Netscape format.

Returns: the binary data of the Netscape encoding

UNKNOWN: Convert the certificate to Netscape format.

toPem

public byte[] toPem()
Convert the certificate to PEM (base64) format.

Returns: the binary data of the PEM encoding

UNKNOWN: Convert the certificate to PEM (base64) format.

toString

public String toString()
Convert this certificate to a string.

Returns: the certificate in base64 format

UNKNOWN: Convert this certificate to a string.

toText

public String toText()
Convert the certificate to OpenSSL plain text format.

Returns: the OpenSSL text encoding

UNKNOWN: Convert the certificate to OpenSSL plain text format.

validate

public int validate()
Check if this is a valid certificate. Will use cached data.

Returns: the result of the validation

UNKNOWN: Check if this is a valid certificate.

validate

public int validate(int p)
Check if this is a valid certificate. Will use cached data.

Parameters: p the purpose to validate for

Returns: the result of the validation

UNKNOWN: Check if this is a valid certificate.

verifyText

public static String verifyText(int x)
Obtain the localized message that corresponds to a validation result.

Parameters: x the code to look up

Returns: the message text corresponding to the validation code

UNKNOWN: Obtain the localized message that corresponds to a validation result.

x509V3Extensions

public KSSLX509V3 x509V3Extensions()
Access the X.509v3 parameters.

Returns: reference to the extension object

See Also: KSSLX509V3

UNKNOWN: Access the X.