IP*Works! S/MIME V9

ipworkssmime
Class Certificate

java.lang.Object
  extended by ipworkssmime.Certificate

public class Certificate
extends java.lang.Object

The digital certificate being used.

This type describes the current digital certificate. The certificate may be a public or private key. The fields are used to identify or select certificates.

EffectiveDate: The date which this certificate becomes valid. Prior to this it is not valid. The following is an example of an encoded date illustrating the format:

23-Jan-2000 15:00:00.

Encoded: The certificate (PEM/base64 encoded). This field is used to assign a specific certificate for client authentication (server authentication in the case of Daemon beans). The Store and Subject fields may also be used to specify a certificate.

When Encoded is set, a search is initiated in the current Store for the private key of the certificate. If the key is found, Subject is updated to reflect the full subject of the selected certificate, otherwise Subject is set to empty string.

ExpirationDate: The date the certificate expires. Dates following this date, the certificate will no longer be valid. The following is an example of an encoded date illustrating the format:

23-Jan-2001 15:00:00.

ExtendedKeyUsage: A comma-delimited list of extended key usage identifiers. These are the same as ASN.1 Object-Identifiers (OIDs).

Fingerprint: The Hex encoded 16-byte MD5 fingerprint of the certificate.

This is in the form:

 bc:2a:72:af:fe:58:17:43:7a:5f:ba:5a:7c:90:f7:02 

Issuer: The issuer of the certificate. This field contains a string representation of the name of the issuing authority for the certificate.

KeyPassword: The password for the certificate's private key (if any).

Some certificate stores may individually protect certificates' private keys, separate from the standard protection offered by the StorePassword . KeyPassword . This can be used to read such password-protected private keys.

Note: this property defaults to the value of StorePassword . To clear it, you must set the property to the empty string (""). It can be set at any time, but must be set before calling PrivateKey when the private key's password is different from the store's.

PrivateKey: The private key of the certificate (if available). The key is provided as PEM/Base64-encoded data.

Note: The PrivateKey may be available, but not exportable. In this case, PrivateKey returns an empty string.

PrivateKeyAvailable: Shows whether a PrivateKey is available for the selected certificate. If PrivateKeyAvailable is True, the certificate may be used for authentication purposes (e.g. server authentication).

PrivateKeyContainer: The name of the PrivateKey container for the certificate (if available). This functionality is available only on Windows platforms.

PublicKey: The public key of the certificate. The key is provided as PEM/Base64-encoded data.

PublicKeyAlgorithm: Textual description of the public key algorithm of the certificate. The property contains either the name of the algorithm (such as "RSA" or "RSA_DH"), or an object identifier (OID) string representing the algorithm.

PublicKeyLength: The length of the certificate public key (in bits). Common values are 512, 1024, and 2048.

SerialNumber: The serial number of the certificate encoded as a string. The number is encoded as a series of hexadecimal digits, each two of them representing a byte of the serial number.

SignatureAlgorithm: Textual description of the signature algorithm of the certificate. The property contains either the name of the algorithm (such as "RSA" or "RSA_MD5RSA"), or an object identifier (OID) string representing the algorithm.

Store: The name of the certificate store for the client certificate.

The StoreType field specifies the type of the certificate store specified by Store . If the store is password protected, specify the password in StorePassword .

Store is used in conjunction with the Subject field in order to specify client certificates. If Store has a value, and Subject or Encoded is set, a search for a certificate is initiated. Please refer to the Subject field for details.

Designations of certificate stores are platform-dependent.

The following are designations of the most common User and Machine certificate stores in Windows:

MY
A certificate store holding personal certificates with their associated private keys.
CA
Certifying authority certificates.
ROOT
Root certificates.
SPC
Software publisher certificates.

In Java, the certificate store normally is a file containing certificates and optional private keys.

When the certificate store type is PFXFile, this property must be set to the name of the file. When the type is PFXBlob, the property must be set to the binary contents of a PFX file (i.e. PKCS12 certificate store).

If the provider is OpenSSL, the certificate store is a file containing a certificate and a private key. This property must be set to the name of the file.

StorePassword: If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.

StoreType: The type of certificate store for this certificate.

This property can take one of the following values:

0 (cstUser - default)
For Windows, this specifies that the certificate store is a certificate store owned by the current user. Note: this store type is not available in Java.
1 (cstMachine)
For Windows, this specifies that the certificate store is a machine store. Note: this store type is not available in Java.
2 (cstPFXFile)
The certificate store is the name of a PFX (PKCS12) file containing certificates.
3 (cstPFXBlob)
The certificate store is a string (binary or base64-encoded) representing a certificate store in PFX (PKCS12) format.
4 (cstJKSFile)
The certificate store is the name of a Java Key Store (JKS) file containing certificates. Note: this store type is only available in Java.
5 (cstJKSBlob)
The certificate store is a string (binary or base64-encoded) representing a certificate store in Java Key Store (JKS) format. Note: this store type is only available in Java.
6 (cstPEMKeyFile)
The certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate.
7 (cstPEMKeyBlob)
The certificate store is a string (binary or base64-encoded) that contains a private key and an optional certificate.
8 (cstPublicKeyFile)
The certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate.
9 (cstPublicKeyBlob)
The certificate store is a string (binary or base64-encoded) that contains a PEM- or DER-encoded public key certificate.
10 (cstSSHPublicKeyBlob)
The certificate store is a string (binary or base64-encoded) that contains an SSH-style public key.
11 (cstP7BFile)
The certificate store is the name of a PKCS7 file containing certificates.
12 (cstP7BBlob)
The certificate store is a string (binary) representing a certificate store in PKCS7 format.
13 (cstSSHPublicKeyFile)
The certificate store is the name of a file that contains an SSH-style public key.

Subject: The subject of the certificate used for client authentication.

This field will be populated with the full subject of the loaded certificate. When loading a certificate the subject is used to locate the certificate in the store.

If an exact match is not found, the store is searched for subjects containing the value of the property.

If a match is still not found, the property is set to an empty string, and no certificate is selected.

The special value "*" picks a random certificate in the certificate store.

SubjectAltNames: A comma-separated lists of alternative subject names of the certificate.

ThumbprintMD5: MD5 hash of the certificate. If the hash does not already exist, it is computed.

ThumbprintSHA1: SHA1 hash of the certificate. If the hash does not already exist, it is computed.

Usage: Textual description of UsageFlags .

The value will be of one or more of the following strings, separated by commas:

If the provider is OpenSSL, the value is a comma separated list of X509 certificate extension names.

UsageFlags: Flags that show intended use for the certificate. The value of UsageFlags is a combination of the following flags:

0x80
Digital Signatures
0x40
Key Authentication
0x20
Key Encryption
0x10
Data Encryption
0x08
Key Agreement
0x04
Certificate Signing
0x02
Key Signing

Please refer to the Usage field for a text representation of UsageFlags .

This functionality is currently not available when the provider is OpenSSL.

Version: The certificate's version number. The possible values are the strings "V1", "V2", and "V3".

See Also:
Certmgr, Certmgr.Certificate

Field Summary
static int cstJKSBlob
           
static int cstJKSFile
           
static int cstMachine
           
static int cstP7BBlob
           
static int cstP7BFile
           
static int cstPEMKeyBlob
           
static int cstPEMKeyFile
           
static int cstPFXBlob
           
static int cstPFXFile
           
static int cstPublicKeyBlob
           
static int cstPublicKeyFile
           
static int cstSSHPublicKeyBlob
           
static int cstSSHPublicKeyFile
           
static int cstUser
           
 
Constructor Summary
Certificate()
           
Certificate(byte[] certificateData)
           
Certificate(int certStoreType, byte[] storeBlob, java.lang.String storePassword, byte[] encoded)
           
Certificate(int certStoreType, byte[] storeBlob, java.lang.String storePassword, java.lang.String subject)
           
Certificate(int certStoreType, java.lang.String store, java.lang.String storePassword, byte[] encoded)
           
Certificate(int certStoreType, java.lang.String store, java.lang.String storePassword, java.lang.String subject)
           
Certificate(java.lang.String certificateFile)
           
 
Method Summary
 java.lang.String getEffectiveDate()
           
 byte[] getEncoded()
           
 java.lang.String getExpirationDate()
           
 java.lang.String getExtendedKeyUsage()
           
 java.lang.String getFingerprint()
           
 java.lang.String getIssuer()
           
 java.lang.String getKeyPassword()
           
 java.lang.String getPrivateKey()
           
 boolean getPrivateKeyAvailable()
           
 java.lang.String getPrivateKeyContainer()
           
 java.lang.String getPublicKey()
           
 java.lang.String getPublicKeyAlgorithm()
           
 int getPublicKeyLength()
           
 java.lang.String getSerialNumber()
           
 java.lang.String getSignatureAlgorithm()
           
 byte[] getStore()
           
 java.lang.String getStorePassword()
           
 int getStoreType()
           
 java.lang.String getSubject()
           
 java.lang.String getSubjectAltNames()
           
 java.lang.String getThumbprintMD5()
           
 java.lang.String getThumbprintSHA1()
           
 java.lang.String getUsage()
           
 int getUsageFlags()
           
 java.lang.String getVersion()
           
 void setEncoded(byte[] value)
           
 void setExtendedKeyUsage(java.lang.String value)
           
 void setKeyPassword(java.lang.String value)
           
 void setPublicKeyAlgorithm(java.lang.String value)
           
 void setStore(byte[] value)
           
 void setStorePassword(java.lang.String value)
           
 void setStoreType(int value)
           
 void setSubject(java.lang.String value)
           
 void setUsage(java.lang.String value)
           
 void setUsageFlags(int value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cstUser

public static final int cstUser
See Also:
Constant Field Values

cstMachine

public static final int cstMachine
See Also:
Constant Field Values

cstPFXFile

public static final int cstPFXFile
See Also:
Constant Field Values

cstPFXBlob

public static final int cstPFXBlob
See Also:
Constant Field Values

cstJKSFile

public static final int cstJKSFile
See Also:
Constant Field Values

cstJKSBlob

public static final int cstJKSBlob
See Also:
Constant Field Values

cstPEMKeyFile

public static final int cstPEMKeyFile
See Also:
Constant Field Values

cstPEMKeyBlob

public static final int cstPEMKeyBlob
See Also:
Constant Field Values

cstPublicKeyFile

public static final int cstPublicKeyFile
See Also:
Constant Field Values

cstPublicKeyBlob

public static final int cstPublicKeyBlob
See Also:
Constant Field Values

cstSSHPublicKeyBlob

public static final int cstSSHPublicKeyBlob
See Also:
Constant Field Values

cstP7BFile

public static final int cstP7BFile
See Also:
Constant Field Values

cstP7BBlob

public static final int cstP7BBlob
See Also:
Constant Field Values

cstSSHPublicKeyFile

public static final int cstSSHPublicKeyFile
See Also:
Constant Field Values
Constructor Detail

Certificate

public Certificate()

Certificate

public Certificate(java.lang.String certificateFile)
            throws IPWorksSMIMEException
Throws:
IPWorksSMIMEException

Certificate

public Certificate(byte[] certificateData)
            throws IPWorksSMIMEException
Throws:
IPWorksSMIMEException

Certificate

public Certificate(int certStoreType,
                   java.lang.String store,
                   java.lang.String storePassword,
                   java.lang.String subject)
            throws IPWorksSMIMEException
Throws:
IPWorksSMIMEException

Certificate

public Certificate(int certStoreType,
                   java.lang.String store,
                   java.lang.String storePassword,
                   byte[] encoded)
            throws IPWorksSMIMEException
Throws:
IPWorksSMIMEException

Certificate

public Certificate(int certStoreType,
                   byte[] storeBlob,
                   java.lang.String storePassword,
                   java.lang.String subject)
            throws IPWorksSMIMEException
Throws:
IPWorksSMIMEException

Certificate

public Certificate(int certStoreType,
                   byte[] storeBlob,
                   java.lang.String storePassword,
                   byte[] encoded)
            throws IPWorksSMIMEException
Throws:
IPWorksSMIMEException
Method Detail

getEffectiveDate

public java.lang.String getEffectiveDate()

getEncoded

public byte[] getEncoded()

setEncoded

public void setEncoded(byte[] value)

getExpirationDate

public java.lang.String getExpirationDate()

getExtendedKeyUsage

public java.lang.String getExtendedKeyUsage()

setExtendedKeyUsage

public void setExtendedKeyUsage(java.lang.String value)

getFingerprint

public java.lang.String getFingerprint()

getIssuer

public java.lang.String getIssuer()

getKeyPassword

public java.lang.String getKeyPassword()

setKeyPassword

public void setKeyPassword(java.lang.String value)

getPrivateKey

public java.lang.String getPrivateKey()

getPrivateKeyAvailable

public boolean getPrivateKeyAvailable()

getPrivateKeyContainer

public java.lang.String getPrivateKeyContainer()

getPublicKey

public java.lang.String getPublicKey()

getPublicKeyAlgorithm

public java.lang.String getPublicKeyAlgorithm()

setPublicKeyAlgorithm

public void setPublicKeyAlgorithm(java.lang.String value)

getPublicKeyLength

public int getPublicKeyLength()

getSerialNumber

public java.lang.String getSerialNumber()

getSignatureAlgorithm

public java.lang.String getSignatureAlgorithm()

getStore

public byte[] getStore()

setStore

public void setStore(byte[] value)

getStorePassword

public java.lang.String getStorePassword()

setStorePassword

public void setStorePassword(java.lang.String value)

getStoreType

public int getStoreType()

setStoreType

public void setStoreType(int value)

getSubject

public java.lang.String getSubject()

setSubject

public void setSubject(java.lang.String value)

getSubjectAltNames

public java.lang.String getSubjectAltNames()

getThumbprintMD5

public java.lang.String getThumbprintMD5()

getThumbprintSHA1

public java.lang.String getThumbprintSHA1()

getUsage

public java.lang.String getUsage()

setUsage

public void setUsage(java.lang.String value)

getUsageFlags

public int getUsageFlags()

setUsageFlags

public void setUsageFlags(int value)

getVersion

public java.lang.String getVersion()

IP*Works! S/MIME V9

Copyright (c) 2013 /n software inc. - All rights reserved.