Class CryptProvider

java.lang.Object
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: 2745 $
Author:
Middleware Services
  • Field Details

    • RANDOM_BYTE_ARRAY_SIZE

      public static final int RANDOM_BYTE_ARRAY_SIZE
      Default size of random byte array.
      See Also:
  • Method Details

    • addProvider

      public static void addProvider(Provider provider, String name)

      This will add an additional security provider.

      Parameters:
      provider - DatagramsDestination
      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