de.fuberlin.wiwiss.ng4j.swp.util
Class PKCS12Utils

java.lang.Object
  extended by de.fuberlin.wiwiss.ng4j.swp.util.PKCS12Utils

public class PKCS12Utils
extends Object


Constructor Summary
PKCS12Utils()
           
 
Method Summary
static PrivateKey decryptPrivateKey(String pkcs12, String password)
           
static Certificate[] getCertChain(String pkcs12, String password)
           
static KeyStore loadAndDecryptPKCS12(String keyStoreFileName, String password)
          Loads and decrypt the PCKS12 file specified in the configuration properties.
static PrivateKey loadPrivateKey(KeyStore ks, String alias, String password)
          Loads the private key from a file specified in the configuration properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PKCS12Utils

public PKCS12Utils()
Method Detail

loadAndDecryptPKCS12

public static KeyStore loadAndDecryptPKCS12(String keyStoreFileName,
                                            String password)
                                     throws SWPSignatureException,
                                            SWPCertificateException,
                                            SWPPKCS12Exception
Loads and decrypt the PCKS12 file specified in the configuration properties.

Returns:
the PKCS12 object, already decrypted.
Throws:
SWPSignatureException
SWPCertificateException
SWPPKCS12Exception

loadPrivateKey

public static PrivateKey loadPrivateKey(KeyStore ks,
                                        String alias,
                                        String password)
                                 throws KeyStoreException,
                                        NoSuchAlgorithmException,
                                        UnrecoverableKeyException
Loads the private key from a file specified in the configuration properties.

Returns:
the private key.
Throws:
UnrecoverableKeyException
NoSuchAlgorithmException
KeyStoreException

decryptPrivateKey

public static PrivateKey decryptPrivateKey(String pkcs12,
                                           String password)
                                    throws SWPSignatureException
Throws:
SWPSignatureException

getCertChain

public static Certificate[] getCertChain(String pkcs12,
                                         String password)