SmimeKey

Inheritance: java.lang.Object

public class SmimeKey

A wrapper around a PrivateKey and a chain of X509Certificate used to sign or decrypt a MIME message.

Constructors

ConstructorDescription
SmimeKey(PrivateKey privateKey, X509Certificate[] certificateChain)Create a new SmimeKey with the given private key and certificate chain.
SmimeKey(X509Certificate[] certificateChain)Create a new SmimeKey with the given private key and certificate chain.

Methods

MethodDescription
equals(Object arg0)
getAssociatedAddresses()Compiles and returns the list of email address associated with the #getCertificate().getCertificate() of this SmimeKey by inspecting the subjects distinguished name.
getCertificate()Returns the certificate that holds the public key that corresponds to the private key of this SmimeKey .
getCertificateChain()Returns the chain of certificates of this SmimeKey starting with the certificate that holds the public key that corresponds to the private key of this SmimeKey and ending with the trust anchor.
getClass()
getPrivateKey()Returns the private key of this SmimeKey .
hashCode()
loadCertificate(InputStream stream)Load a new SmimeKey with the given certificate from string —–CERTIFICATE—–
loadCertificate(String crtPath)Load a new SmimeKey with the given private key and certificate from string —–CERTIFICATE—–
loadPFX(InputStream stream, char[] password)Load a new SmimeKey with the given private key and certificate from PFX store
loadPFX(InputStream stream, String alias, char[] password)Load a new SmimeKey with the given private key and certificate from PFX store
loadPFX(String pfxPath, char[] password)Load a new SmimeKey with the given private key and certificate from PFX store
loadPFX(String pfxPath, String alias, char[] password)Load a new SmimeKey with the given private key and certificate from PFX store
loadPrivateKey(InputStream stream)Load a new SmimeKey with the given private key from string —RSA PRIVATE KEY—.
loadPrivateKey(String keyPath)Load a new SmimeKey with the given private key from string —–RSA PRIVATE KEY—–
notify()
notifyAll()
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

SmimeKey(PrivateKey privateKey, X509Certificate[] certificateChain)

public SmimeKey(PrivateKey privateKey, X509Certificate[] certificateChain)

Create a new SmimeKey with the given private key and certificate chain.

Parameters:

ParameterTypeDescription
privateKeyjava.security.PrivateKeyThe PrivateKey of this SmimeKey
certificateChainjava.security.cert.X509Certificate[]The chain of X509Certificate of this SmimeKey starting with the certificate that holds the public key that corresponds to the given private key and ending with the trust anchor.

SmimeKey(X509Certificate[] certificateChain)

public SmimeKey(X509Certificate[] certificateChain)

Create a new SmimeKey with the given private key and certificate chain.

Parameters:

ParameterTypeDescription
certificateChainjava.security.cert.X509Certificate[]The chain of X509Certificate of this SmimeKey starting with the certificate that holds the public key that corresponds to the given private key and ending with the trust anchor.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getAssociatedAddresses()

public List<String> getAssociatedAddresses()

Compiles and returns the list of email address associated with the #getCertificate().getCertificate() of this SmimeKey by inspecting the subjects distinguished name.

Returns: java.util.List<java.lang.String> - A Collections#unmodifiableList(List).unmodifiableList(List) of email addresses.

getCertificate()

public X509Certificate getCertificate()

Returns the certificate that holds the public key that corresponds to the private key of this SmimeKey .

Returns: java.security.cert.X509Certificate - The X509Certificate.

getCertificateChain()

public X509Certificate[] getCertificateChain()

Returns the chain of certificates of this SmimeKey starting with the certificate that holds the public key that corresponds to the private key of this SmimeKey and ending with the trust anchor.

Returns: java.security.cert.X509Certificate[] - The chain of X509Certificate.

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getPrivateKey()

public PrivateKey getPrivateKey()

Returns the private key of this SmimeKey .

Returns: java.security.PrivateKey - The PrivateKey.

hashCode()

public native int hashCode()

Returns: int

loadCertificate(InputStream stream)

public static SmimeKey loadCertificate(InputStream stream)

Load a new SmimeKey with the given certificate from string —–CERTIFICATE—–

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe InputStream to read the certificate from.

Returns: SmimeKey

loadCertificate(String crtPath)

public static SmimeKey loadCertificate(String crtPath)

Load a new SmimeKey with the given private key and certificate from string —–CERTIFICATE—–

Parameters:

ParameterTypeDescription
crtPathjava.lang.StringThe path to the file containing certificate.

Returns: SmimeKey

loadPFX(InputStream stream, char[] password)

public static SmimeKey loadPFX(InputStream stream, char[] password)

Load a new SmimeKey with the given private key and certificate from PFX store

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe InputStream to read the PFX store from.
passwordchar[]The password to unlock the PFX store with.

Returns: SmimeKey

loadPFX(InputStream stream, String alias, char[] password)

public static SmimeKey loadPFX(InputStream stream, String alias, char[] password)

Load a new SmimeKey with the given private key and certificate from PFX store

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe InputStream to read the PFX store from.
aliasjava.lang.StringThe alias of the key entry in the PFX store.
passwordchar[]The password to unlock the PFX store with.

Returns: SmimeKey

loadPFX(String pfxPath, char[] password)

public static SmimeKey loadPFX(String pfxPath, char[] password)

Load a new SmimeKey with the given private key and certificate from PFX store

Parameters:

ParameterTypeDescription
pfxPathjava.lang.StringThe path to the PFX file
passwordchar[]The password to unlock the PFX store with.

Returns: SmimeKey

loadPFX(String pfxPath, String alias, char[] password)

public static SmimeKey loadPFX(String pfxPath, String alias, char[] password)

Load a new SmimeKey with the given private key and certificate from PFX store

Parameters:

ParameterTypeDescription
pfxPathjava.lang.StringThe path to the PFX file
aliasjava.lang.StringThe alias of the key entry in the PFX store.
passwordchar[]The password to unlock the PFX store with.

Returns: SmimeKey

loadPrivateKey(InputStream stream)

public static SmimeKey loadPrivateKey(InputStream stream)

Load a new SmimeKey with the given private key from string —RSA PRIVATE KEY—.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe InputStream to read the private key from.

Returns: SmimeKey

loadPrivateKey(String keyPath)

public static SmimeKey loadPrivateKey(String keyPath)

Load a new SmimeKey with the given private key from string —–RSA PRIVATE KEY—–

Parameters:

ParameterTypeDescription
keyPathjava.lang.StringThe path to the file containing the private key.

Returns: SmimeKey

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int