edu.vt.middleware.crypt
Class CryptProvider

java.lang.Object
  extended by edu.vt.middleware.crypt.CryptProvider

public final class CryptProvider
extends Object

CryptProvider contains methods for finding cryptographic objects using a set of providers.

Version:
$Revision: 3 $
Author:
Middleware Services

Field Summary
static int RANDOM_BYTE_ARRAY_SIZE
          Default size of random byte array.
 
Method Summary
static void addProvider(Provider provider, String name)
          This will add an additional security provider.
static CertificateFactory getCertificateFactory(String type)
          This creates a CertificateFactory using the supplied type name.
static Cipher getCipher(String algorithm, String mode, String padding)
          This finds a Cipher using the known providers and the supplied parameters.
static KeyFactory getKeyFactory(String algorithm)
          This finds a KeyFactory using the known providers and the supplied algorithm parameter.
static KeyGenerator getKeyGenerator(String algorithm)
          This finds a KeyGenerator using the known providers and the supplied algorithm parameter.
static KeyPairGenerator getKeyPairGenerator(String algorithm)
          This finds a KeyPairGenerator using the known providers and the supplied algorithm parameter.
static KeyStore getKeyStore()
          This creates a KeyStore using the default keystore type.
static KeyStore getKeyStore(String type)
          This creates a KeyStore using the supplied type name.
static MessageDigest getMessageDigest(String algorithm)
          This creates a MessageDigest using the supplied algorithm name.
static SecretKeyFactory getSecretKeyFactory(String algorithm)
          This finds a SecretKeyFactory using the known providers and the supplied algorithm parameter.
static Signature getSignature(String digestAlgorithm, String algorithm, String padding)
          This finds a Signature using the known providers and the supplied parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RANDOM_BYTE_ARRAY_SIZE

public static final int RANDOM_BYTE_ARRAY_SIZE
Default size of random byte array.

See Also:
Constant Field Values
Method Detail

addProvider

public static void addProvider(Provider provider,
                               String name)

This will add an additional security provider.

Parameters:
provider - Provider
name - String

getCipher

public static Cipher getCipher(String algorithm,
                               String mode,
                               String padding)
                        throws CryptException

This finds a Cipher using the known providers and the supplied parameters.

Parameters:
algorithm - String name
mode - String name
padding - String name
Returns:
Cipher
Throws:
CryptException - if the algorithm is not available from any provider or if the provider is not available in the environment

getSecretKeyFactory

public static SecretKeyFactory getSecretKeyFactory(String algorithm)
                                            throws CryptException

This finds a SecretKeyFactory using the known providers and the supplied algorithm parameter.

Parameters:
algorithm - String name
Returns:
SecretKeyFactory
Throws:
CryptException - if the algorithm is not available from any provider or if the provider is not available in the environment

getKeyFactory

public static KeyFactory getKeyFactory(String algorithm)
                                throws CryptException

This finds a KeyFactory using the known providers and the supplied algorithm parameter.

Parameters:
algorithm - String name
Returns:
KeyFactory
Throws:
CryptException - if the algorithm is not available from any provider or if the provider is not available in the environment

getKeyGenerator

public static KeyGenerator getKeyGenerator(String algorithm)
                                    throws CryptException

This finds a KeyGenerator using the known providers and the supplied algorithm parameter.

Parameters:
algorithm - String name
Returns:
KeyGenerator
Throws:
CryptException - if the algorithm is not available from any provider or if the provider is not available in the environment

getKeyPairGenerator

public static KeyPairGenerator getKeyPairGenerator(String algorithm)
                                            throws CryptException

This finds a KeyPairGenerator using the known providers and the supplied algorithm parameter.

Parameters:
algorithm - String name
Returns:
KeyPairGenerator
Throws:
CryptException - if the algorithm is not available from any provider or if the provider is not available in the environment

getSignature

public static Signature getSignature(String digestAlgorithm,
                                     String algorithm,
                                     String padding)
                              throws CryptException

This finds a Signature using the known providers and the supplied parameters.

Parameters:
digestAlgorithm - String name
algorithm - String name
padding - String name
Returns:
Signature
Throws:
CryptException - if the algorithm is not available from any provider or if the provider is not available in the environment

getMessageDigest

public static MessageDigest getMessageDigest(String algorithm)
                                      throws CryptException

This creates a MessageDigest using the supplied algorithm name.

Parameters:
algorithm - String name
Returns:
MessageDigest
Throws:
CryptException - if the algorithm is not available from any provider or the provider is not available in the environment

getKeyStore

public static KeyStore getKeyStore(String type)
                            throws CryptException

This creates a KeyStore using the supplied type name.

Parameters:
type - String
Returns:
KeyStore
Throws:
CryptException - if the type is not available from any provider or the provider is not available in the environment

getKeyStore

public static KeyStore getKeyStore()
                            throws CryptException

This creates a KeyStore using the default keystore type.

Returns:
KeyStore
Throws:
CryptException - if the default type is not available from any provider or the provider is not available in the environment

getCertificateFactory

public static CertificateFactory getCertificateFactory(String type)
                                                throws CryptException

This creates a CertificateFactory using the supplied type name.

Parameters:
type - String
Returns:
CertificateFactory
Throws:
CryptException - if the type is not available from any provider or the provider is not available in the environment


Copyright © 2003-2011 Virginia Tech. All Rights Reserved.