org.webdocwf.util.smime.util
Class PFXUtils

java.lang.Object
  |
  +--org.webdocwf.util.smime.util.PFXUtils

public class PFXUtils
extends java.lang.Object

PFXUtils class has static methods which are dealing with .pfx, or .p12 files. The file (of this types) presents storage for keeping certificate chain and private key. Information from this files are being transported through programs via instance of the Java class KeyStore.


Constructor Summary
PFXUtils()
           
 
Method Summary
static java.security.cert.X509Certificate[] getAllX509Certificate(java.security.KeyStore ks0)
          Returns all X509 Certificates stored in .pfx, or .p12 files (KeyStore).
static java.security.cert.X509Certificate[] getCertificateChain(java.security.KeyStore ks0)
          Returns all X509 Certificates stored in .pfx, or .p12 files (KeyStore).
static java.security.cert.X509Certificate getPFXOwnerX509Certificate(java.security.KeyStore ks0)
          Returns the owner's Certificate from his .pfx or .p12 file (KeyStore)
static java.security.PrivateKey getPrivateKey(java.security.KeyStore ks0)
          Returns the Private key of the certificate's owner from .pfx or .p12 file (pkcs12 format)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PFXUtils

public PFXUtils()
Method Detail

getPFXOwnerX509Certificate

public static java.security.cert.X509Certificate getPFXOwnerX509Certificate(java.security.KeyStore ks0)
                                                                     throws SMIMEException
Returns the owner's Certificate from his .pfx or .p12 file (KeyStore)
Parameters:
ks0 - container for information from .pfx or .p12 file
Returns:
Owner's Certificate
Throws:
SMIMEException - if problem with extracting certificate chain from .pfx or .p12 file or with aliases in pfx or p12 file arrises. Also, it can be caused by non SMIMEException which is KeyStoreException.

getPrivateKey

public static java.security.PrivateKey getPrivateKey(java.security.KeyStore ks0)
                                              throws SMIMEException
Returns the Private key of the certificate's owner from .pfx or .p12 file (pkcs12 format)
Parameters:
ks0 - container for information from .pfx or .p12 file
Returns:
Owners private key
Throws:
SMIMEException - caused by non SMIMEException which can be one of the following: KeyStoreException, UnrecoverableKeyException or NoSuchAlgorithmException.

getAllX509Certificate

public static java.security.cert.X509Certificate[] getAllX509Certificate(java.security.KeyStore ks0)
                                                                  throws SMIMEException
Returns all X509 Certificates stored in .pfx, or .p12 files (KeyStore). This method performs same task as method getCertificateChain() but on less elegant way. In the future project version, it will be completely replaced with the getCertificateChain() method.
Parameters:
ks0 - container for information from .pfx or .p12 file
Returns:
Certificate chain represented as array of X509Certificate objects with the owner's certificate at the first place.
Throws:
SMIMEException - if problem with extracting certificate chain from .pfx or .p12 file or with aliases in pfx or p12 file arrises. Also, it can be caused by non SMIMEException which is KeyStoreException.

getCertificateChain

public static java.security.cert.X509Certificate[] getCertificateChain(java.security.KeyStore ks0)
                                                                throws SMIMEException
Returns all X509 Certificates stored in .pfx, or .p12 files (KeyStore). This method performs same task as method getAllX509Certificate() but on more elegant way.
Parameters:
ks0 - container for information from .pfx or .p12 file
Returns:
Certificate chain represented as array of X509Certificate objects with the owner's certificate at the first place.
Throws:
SMIMEException - caused by non SMIMEException which is KeyStoreException.


Copyright © 2002-2002 Together Teamlösungen. All Rights Reserved.