org.apache.abdera.security.util
Class KeyHelper

java.lang.Object
  extended by org.apache.abdera.security.util.KeyHelper

public class KeyHelper
extends java.lang.Object


Constructor Summary
KeyHelper()
           
 
Method Summary
static java.security.Key generateKey(java.lang.String type)
           
static java.security.KeyPair generateKeyPair(java.lang.String type, int size)
           
static java.security.KeyPair generateKeyPair(java.lang.String type, int size, java.lang.String provider)
           
static java.security.PublicKey generatePublicKey(java.lang.String hex)
           
static javax.crypto.SecretKey generateSecretKey(java.lang.String type, int size)
           
static javax.crypto.SecretKey generateSecretKey(java.lang.String type, int size, java.lang.String provider)
           
static
<T extends java.security.cert.Certificate>
T
getCertificate(java.security.KeyStore ks, java.lang.String alias)
           
static
<T extends java.security.Key>
T
getKey(java.security.KeyStore ks, java.lang.String alias, java.lang.String pass)
           
static java.security.KeyStore loadKeystore(java.lang.String file, java.lang.String pass)
           
static java.security.KeyStore loadKeystore(java.lang.String type, java.lang.String file, java.lang.String pass)
           
static void saveKeystore(java.security.KeyStore ks, java.lang.String file, java.lang.String password)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyHelper

public KeyHelper()
Method Detail

saveKeystore

public static void saveKeystore(java.security.KeyStore ks,
                                java.lang.String file,
                                java.lang.String password)
                         throws java.security.KeyStoreException,
                                java.security.NoSuchAlgorithmException,
                                java.security.cert.CertificateException,
                                java.io.FileNotFoundException,
                                java.io.IOException
Throws:
java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException
java.io.FileNotFoundException
java.io.IOException

loadKeystore

public static java.security.KeyStore loadKeystore(java.lang.String file,
                                                  java.lang.String pass)
                                           throws java.security.KeyStoreException,
                                                  java.security.NoSuchAlgorithmException,
                                                  java.security.cert.CertificateException,
                                                  java.io.IOException
Throws:
java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException
java.io.IOException

loadKeystore

public static java.security.KeyStore loadKeystore(java.lang.String type,
                                                  java.lang.String file,
                                                  java.lang.String pass)
                                           throws java.security.KeyStoreException,
                                                  java.security.NoSuchAlgorithmException,
                                                  java.security.cert.CertificateException,
                                                  java.io.IOException
Throws:
java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException
java.io.IOException

getKey

public static <T extends java.security.Key> T getKey(java.security.KeyStore ks,
                                                     java.lang.String alias,
                                                     java.lang.String pass)
                                          throws java.security.KeyStoreException,
                                                 java.security.NoSuchAlgorithmException,
                                                 java.security.UnrecoverableKeyException
Throws:
java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.UnrecoverableKeyException

getCertificate

public static <T extends java.security.cert.Certificate> T getCertificate(java.security.KeyStore ks,
                                                                          java.lang.String alias)
                                                               throws java.security.KeyStoreException
Throws:
java.security.KeyStoreException

generateKeyPair

public static java.security.KeyPair generateKeyPair(java.lang.String type,
                                                    int size)
                                             throws java.security.NoSuchAlgorithmException,
                                                    java.security.NoSuchProviderException
Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException

generateKeyPair

public static java.security.KeyPair generateKeyPair(java.lang.String type,
                                                    int size,
                                                    java.lang.String provider)
                                             throws java.security.NoSuchAlgorithmException,
                                                    java.security.NoSuchProviderException
Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException

generateSecretKey

public static javax.crypto.SecretKey generateSecretKey(java.lang.String type,
                                                       int size)
                                                throws java.security.NoSuchAlgorithmException,
                                                       java.security.NoSuchProviderException
Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException

generateKey

public static java.security.Key generateKey(java.lang.String type)
                                     throws java.security.NoSuchAlgorithmException
Throws:
java.security.NoSuchAlgorithmException

generateSecretKey

public static javax.crypto.SecretKey generateSecretKey(java.lang.String type,
                                                       int size,
                                                       java.lang.String provider)
                                                throws java.security.NoSuchAlgorithmException,
                                                       java.security.NoSuchProviderException
Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException

generatePublicKey

public static java.security.PublicKey generatePublicKey(java.lang.String hex)