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
Constructor | Description |
---|---|
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
Method | Description |
---|---|
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:
Parameter | Type | Description |
---|---|---|
privateKey | java.security.PrivateKey | The PrivateKey of this SmimeKey |
certificateChain | java.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:
Parameter | Type | Description |
---|---|---|
certificateChain | java.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:
Parameter | Type | Description |
---|---|---|
arg0 | java.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:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The 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:
Parameter | Type | Description |
---|---|---|
crtPath | java.lang.String | The 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:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The InputStream to read the PFX store from. |
password | char[] | 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:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The InputStream to read the PFX store from. |
alias | java.lang.String | The alias of the key entry in the PFX store. |
password | char[] | 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:
Parameter | Type | Description |
---|---|---|
pfxPath | java.lang.String | The path to the PFX file |
password | char[] | 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:
Parameter | Type | Description |
---|---|---|
pfxPath | java.lang.String | The path to the PFX file |
alias | java.lang.String | The alias of the key entry in the PFX store. |
password | char[] | 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:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The 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:
Parameter | Type | Description |
---|---|---|
keyPath | java.lang.String | The 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:
Parameter | Type | Description |
---|---|---|
arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long | |
arg1 | int |