Package anbxj

# Class Crypto_Config

java.lang.Object
anbxj.Crypto_Config

public class Crypto_Config extends Object
An abstract class for encryption configuration.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected String`
  `asymCipherSchemeBlock`
  The asymmetric cipher scheme block.
  `protected String`
  `asymEncProvider`
  The provider for signature algorithm.
  `protected String`
  `cipherScheme`
  The cipher scheme.
  `protected String`
  `cipherSchemeProvider`
  The provider for cipher scheme.
  `protected int`
  `dhModulusSize`
  The Diffie-Hellman random exponent size.
  `protected String`
  `ecGenParameterSpec`
  The Elliptic Curve.
  `protected String`
  `hmacAlgorithm`
  The HMAC algorithm.
  `protected int`
  `hmacKeySize`
  The HMAC algorithm key size.
  `protected String`
  `hmacProvider`
  The provider for HMAC algorithm.
  `protected String`
  `keyAgreementAlgorithm`
  The key agreement algorithm.
  `protected String`
  `keyAgreementKeyPairGenerationScheme`
  The key pair generation for key agreement algorithm.
  `protected String`
  `keyAgreementProvider`
  The provider for key agreement algorithm.
  `protected String`
  `keyGenerationScheme`
  The key generation scheme.
  `protected String`
  `keyGenerationSchemePBE`
  The key generation scheme for password-based encryption (PBE).
  `protected String`
  `keyGenerationSchemePBEProvider`
  The provider for PBE key generation.
  `protected String`
  `keyGenerationSchemeProvider`
  The provider for key generation.
  `protected int`
  `keyGenerationSize`
  The key generation size.
  `protected String`
  `keyPairGenerationScheme`
  The key pair generation scheme.
  `protected String`
  `keyPairGenerationSchemeProvider`
  The provider for key pair generation.
  `protected int`
  `keyPairGenerationSize`
  The key pair generation size.
  `protected int`
  `keySize`
  The key size.
  `protected Map<String,String>`
  `keyTypeToCipherMap`
  Mapping of key algorithm names to cipher transformation strings.
  `protected Map<String,String>`
  `keyTypeToSignatureMap`
  Mapping of asymmetric key algorithm names to signature algorithm names.
  `protected String`
  `messageDigestAlgorithm`
  The message digest algorithm.
  `protected String`
  `messageDigestProvider`
  The provider for message digest algorithm.
  `protected String`
  `messageDigestSignatureAlgorithm`
  The message digest algorithm.
  `protected String`
  `secureRandomAlgorithm`
  The secure random algorithm.
  `protected String`
  `secureRandomProvider`
  The provider for secure random algorithm.
  `protected String`
  `securityProvider`
  The global security provider.
  `protected String`
  `signatureProvider`
  The provider for signature algorithm.
  `protected String`
  `sslContext`
  The SSL context.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Crypto_Config()`
  Constructs a Crypto_Config object with default values.
  `Crypto_Config(String cipherScheme, int keySize, String keyGenerationScheme, String keyGenerationSchemePBE, int keyGenerationSize, String keyPairGenerationScheme, int keyPairGenerationSize, String secureRandomAlgorithm, String hmacAlgorithm, int hmacKeySize, String messageDigestAlgorithm, String messageDigestSignatureAlgorithm, String keyAgreementAlgorithm, String keyAgreementKeyPairGenerationScheme, int dhModulusSize, String ecGenParameterSpec, String asymCipherSchemeBlock, String sslContext, String keyTypeToCipher, String keyTypeToSignature, String securityProvider)`
  Constructs a Crypto_Config object with a global provider.
  `Crypto_Config(String cipherScheme, int keySize, String keyGenerationScheme, String keyGenerationSchemePBE, int keyGenerationSize, String keyPairGenerationScheme, int keyPairGenerationSize, String secureRandomAlgorithm, String hmacAlgorithm, int hmacKeySize, String messageDigestAlgorithm, String messageDigestSignatureAlgorithm, String keyAgreementAlgorithm, String keyAgreementKeyPairGenerationScheme, int dhModulusSize, String ecGenParameterSpec, String asymCipherSchemeBlock, String sslContext, String keyTypeToCipher, String keyTypeToSignature, String securityProvider, String cipherSchemeProvider, String keyGenerationSchemeProvider, String keyGenerationSchemePBEProvider, String keyPairGenerationSchemeProvider, String secureRandomProvider, String hmacProvider, String messageDigestProvider, String signatureProvider, String asymEncProvider, String keyAgreementProvider, String sslContextProvider)`
  Constructs a Crypto_Config object with all the fine-grained providers.
  `Crypto_Config(Properties configFile)`
  Constructs a Crypto_Config object from the properties specified in the given configuration file.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getAsymCipherSchemeBlock()`
  Returns the asymmetric cipher scheme block.
  `String`
  `getAsymEncProvider()`
  Returns the provider for asymmetric encryption algorithm.
  `Map<String,String>`
  `getAsymKeyTypeToCipherMap()`
  Returns the asymmetric Key type to Cipher Map
  `Map<String,String>`
  `getAsymKeyTypeToSignatureMap()`
  Returns the asymmetric Key type to Signature Map
  `String`
  `getCipherScheme()`
  Returns the cipher scheme.
  `String`
  `getCipherSchemeProvider()`
  Returns the provider for the cipher scheme.
  `int`
  `getdhModulusSize()`
  Returns the Diffie-Hellman random exponent size.
  `String`
  `getEcGenParameterSpec()`
  Returns the Elliptic Curve.
  `String`
  `getHmacAlgorithm()`
  Returns the HMAC algorithm.
  `String`
  `getHmacProvider()`
  Returns the provider for HMAC algorithm.
  `void`
  `getInfo()`
  Prints debug information about the crypto configuration.
  `String`
  `getKeyAgreementAlgorithm()`
  Returns the key agreement algorithm.
  `String`
  `getKeyAgreementKeyPairGenerationScheme()`
  Returns the key pair generation scheme for key agreement algorithm.
  `String`
  `getKeyAgreementProvider()`
  Returns the provider for key agreement algorithm.
  `String`
  `getKeyGenerationScheme()`
  Returns the key generation scheme.
  `String`
  `getkeyGenerationSchemePBEProvider()`
  Returns the provider for PBE key generation.
  `String`
  `getkeyGenerationSchemeProvider()`
  Returns the provider for key generation.
  `int`
  `getKeyGenerationSize()`
  Returns the key generation size.
  `String`
  `getKeyPairGenerationProvider()`
  Returns the provider for key pair generation.
  `String`
  `getKeyPairGenerationScheme()`
  Returns the key pair generation scheme.
  `int`
  `getKeyPairGenerationSize()`
  Returns the key pair generation size.
  `int`
  `getKeySize()`
  Returns the key size.
  `String`
  `getMessageDigestAlgorithm()`
  Returns the message digest algorithm.
  `String`
  `getMessageDigestProvider()`
  Returns the provider for message digest algorithm.
  `String`
  `getMessageDigestSignatureAlgorithm()`
  Returns the message digest signature algorithm.
  `String`
  `getSecureRandomAlgorithm()`
  Returns the secure random algorithm.
  `String`
  `getSecureRandomProvider()`
  Returns the provider for secure random algorithm.
  `String`
  `getSecurityProvider()`
  Returns the global security provider.
  `String`
  `getSignatureProvider()`
  Returns the provider for signature algorithm.
  `String`
  `getSslContext()`
  Returns the SSL context.
  `String`
  `getSslContextProvider()`
  Returns the provider for SSL context.
  `static boolean`
  `testStr(String str)`
  Checks if a string is not null and not empty.

  ### Methods inherited from class java.lang.Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### cipherScheme

    protected String cipherScheme
    The cipher scheme.

  - ### keySize

    protected int keySize
    The key size.

  - ### keyGenerationScheme

    protected String keyGenerationScheme
    The key generation scheme.

  - ### keyGenerationSize

    protected int keyGenerationSize
    The key generation size.

  - ### keyGenerationSchemePBE

    protected String keyGenerationSchemePBE
    The key generation scheme for password-based encryption (PBE).

  - ### keyPairGenerationScheme

    protected String keyPairGenerationScheme
    The key pair generation scheme.

  - ### keyPairGenerationSize

    protected int keyPairGenerationSize
    The key pair generation size.

  - ### secureRandomAlgorithm

    protected String secureRandomAlgorithm
    The secure random algorithm.

  - ### hmacAlgorithm

    protected String hmacAlgorithm
    The HMAC algorithm.

  - ### hmacKeySize

    protected int hmacKeySize
    The HMAC algorithm key size.

  - ### messageDigestAlgorithm

    protected String messageDigestAlgorithm
    The message digest algorithm.

  - ### messageDigestSignatureAlgorithm

    protected String messageDigestSignatureAlgorithm
    The message digest algorithm.

  - ### keyAgreementAlgorithm

    protected String keyAgreementAlgorithm
    The key agreement algorithm.

  - ### keyAgreementKeyPairGenerationScheme

    protected String keyAgreementKeyPairGenerationScheme
    The key pair generation for key agreement algorithm.

  - ### dhModulusSize

    protected int dhModulusSize
    The Diffie-Hellman random exponent size.

  - ### ecGenParameterSpec

    protected String ecGenParameterSpec
    The Elliptic Curve.

  - ### asymCipherSchemeBlock

    protected String asymCipherSchemeBlock
    The asymmetric cipher scheme block.

  - ### sslContext

    protected String sslContext
    The SSL context.

  - ### keyTypeToCipherMap

    protected Map<String,String> keyTypeToCipherMap
    Mapping of key algorithm names to cipher transformation strings. This map is pre-populated with the default entries defined in `Crypto_Config_Default.defaultKeyTypeToCipherMap`. You can override or extend it via your configuration file (e.g. properties entry "keyTypeToCipher") to handle any custom or provider-specific cipher transformations per key type.

  - ### keyTypeToSignatureMap

    protected Map<String,String> keyTypeToSignatureMap
    Mapping of asymmetric key algorithm names to signature algorithm names. This map is pre-populated with the default entries defined in `Crypto_Config_Default.defaultKeyTypeToSignatureMap`. You can override or extend it via your configuration file (e.g. properties entry "keyTypeToSignature") to handle any special or non-standard algorithm naming cases.

  - ### securityProvider

    protected String securityProvider
    The global security provider.

  - ### cipherSchemeProvider

    protected String cipherSchemeProvider
    The provider for cipher scheme.

  - ### keyGenerationSchemeProvider

    protected String keyGenerationSchemeProvider
    The provider for key generation.

  - ### keyGenerationSchemePBEProvider

    protected String keyGenerationSchemePBEProvider
    The provider for PBE key generation.

  - ### keyPairGenerationSchemeProvider

    protected String keyPairGenerationSchemeProvider
    The provider for key pair generation.

  - ### secureRandomProvider

    protected String secureRandomProvider
    The provider for secure random algorithm.

  - ### hmacProvider

    protected String hmacProvider
    The provider for HMAC algorithm.

  - ### messageDigestProvider

    protected String messageDigestProvider
    The provider for message digest algorithm.

  - ### signatureProvider

    protected String signatureProvider
    The provider for signature algorithm.

  - ### asymEncProvider

    protected String asymEncProvider
    The provider for signature algorithm.

  - ### keyAgreementProvider

    protected String keyAgreementProvider
    The provider for key agreement algorithm.

- ## Constructor Details

  - ### Crypto_Config

    public Crypto_Config()
    Constructs a Crypto_Config object with default values.

  - ### Crypto_Config

    public Crypto_Config(String cipherScheme, int keySize, String keyGenerationScheme, String keyGenerationSchemePBE, int keyGenerationSize, String keyPairGenerationScheme, int keyPairGenerationSize, String secureRandomAlgorithm, String hmacAlgorithm, int hmacKeySize, String messageDigestAlgorithm, String messageDigestSignatureAlgorithm, String keyAgreementAlgorithm, String keyAgreementKeyPairGenerationScheme, int dhModulusSize, String ecGenParameterSpec, String asymCipherSchemeBlock, String sslContext, String keyTypeToCipher, String keyTypeToSignature, String securityProvider)
    Constructs a Crypto_Config object with a global provider.
    Parameters:
      `cipherScheme` - The cipher scheme.
      `keySize` - The key size.
      `keyGenerationScheme` - The key generation scheme.
      `keyGenerationSchemePBE` - The key generation scheme for password-based encryption (PBE).
      `keyGenerationSize` - The key generation size.
      `keyPairGenerationScheme` - The key pair generation scheme.
      `keyPairGenerationSize` - The key pair generation size.
      `secureRandomAlgorithm` - The secure random algorithm.
      `hmacAlgorithm` - The HMAC algorithm.
      `hmacKeySize` - The HMAC algorithm key size.
      `messageDigestAlgorithm` - The message digest algorithm.
      `messageDigestSignatureAlgorithm` - The message digest algorithm for signature.
      `keyAgreementAlgorithm` - The key agreement algorithm.
      `keyAgreementKeyPairGenerationScheme` - The key pair generation scheme for key agreement algorithm
      `dhModulusSize` - The Diffie-Hellman random exponent size.
      `ecGenParameterSpec` - The elliptic curve
      `asymCipherSchemeBlock` - The asymmetric cipher scheme block.
      `sslContext` - The SSL context.
      `keyTypeToCipher` - The key type to cipher mapping.
      `keyTypeToSignature` - The key type to signature algorithm mapping.
      `securityProvider` - The security provider.

  - ### Crypto_Config

    public Crypto_Config(String cipherScheme, int keySize, String keyGenerationScheme, String keyGenerationSchemePBE, int keyGenerationSize, String keyPairGenerationScheme, int keyPairGenerationSize, String secureRandomAlgorithm, String hmacAlgorithm, int hmacKeySize, String messageDigestAlgorithm, String messageDigestSignatureAlgorithm, String keyAgreementAlgorithm, String keyAgreementKeyPairGenerationScheme, int dhModulusSize, String ecGenParameterSpec, String asymCipherSchemeBlock, String sslContext, String keyTypeToCipher, String keyTypeToSignature, String securityProvider, String cipherSchemeProvider, String keyGenerationSchemeProvider, String keyGenerationSchemePBEProvider, String keyPairGenerationSchemeProvider, String secureRandomProvider, String hmacProvider, String messageDigestProvider, String signatureProvider, String asymEncProvider, String keyAgreementProvider, String sslContextProvider)
    Constructs a Crypto_Config object with all the fine-grained providers.
    Parameters:
      `cipherScheme` - The cipher scheme.
      `keySize` - The key size.
      `keyGenerationScheme` - The key generation scheme.
      `keyGenerationSchemePBE` - The key generation scheme for password-based encryption (PBE).
      `keyGenerationSize` - The key generation size.
      `keyPairGenerationScheme` - The key pair generation scheme.
      `keyPairGenerationSize` - The key pair generation size.
      `secureRandomAlgorithm` - The secure random algorithm.
      `hmacAlgorithm` - The HMAC algorithm.
      `hmacKeySize` - The HMAC algorithm key size.
      `messageDigestAlgorithm` - The message digest algorithm.
      `messageDigestSignatureAlgorithm` - The message digest signature algorithm.
      `keyAgreementAlgorithm` - The key agreement algorithm.
      `keyAgreementKeyPairGenerationScheme` - The key pair generation scheme for key agreement algorithm
      `dhModulusSize` - The Diffie-Hellman random exponent size.
      `ecGenParameterSpec` - The elliptic curve
      `asymCipherSchemeBlock` - The asymmetric cipher scheme block.
      `sslContext` - The SSL context.
      `keyTypeToCipher` - The key type to cipher mapping.
      `keyTypeToSignature` - The key type to signature algorithm mapping.
      `securityProvider` - The global security provider.
      `cipherSchemeProvider` - The provider for cipher scheme.
      `keyGenerationSchemeProvider` - The provider for key generation.
      `keyGenerationSchemePBEProvider` - The provider for PBE key generation.
      `keyPairGenerationSchemeProvider` - The provider for key pair generation.
      `secureRandomProvider` - The provider for secure random algorithm.
      `hmacProvider` - The provider for HMAC algorithm.
      `messageDigestProvider` - The provider for message digest algorithm.
      `signatureProvider` - The provider for Signature
      `asymEncProvider` - The provider for asymmetric encryption.
      `keyAgreementProvider` - The provider for key agreement algorithm.
      `sslContextProvider` - The provider for SSL context.

  - ### Crypto_Config

    public Crypto_Config(Properties configFile)
    Constructs a Crypto_Config object from the properties specified in the given configuration file.
    Parameters:
      `configFile` - The properties configuration file.

- ## Method Details

  - ### testStr

    public static boolean testStr(String str)
    Checks if a string is not null and not empty.
    Parameters:
      `str` - The string to test.
    Returns:
      `true` if the string is not null and not empty; `false` otherwise.

  - ### getInfo

    public void getInfo()
    Prints debug information about the crypto configuration.

  - ### getCipherScheme

    public String getCipherScheme()
    Returns the cipher scheme.
    Returns:
      The cipher scheme.

  - ### getKeySize

    public int getKeySize()
    Returns the key size.
    Returns:
      The key size.

  - ### getKeyGenerationScheme

    public String getKeyGenerationScheme()
    Returns the key generation scheme.
    Returns:
      The key generation scheme.

  - ### getKeyGenerationSize

    public int getKeyGenerationSize()
    Returns the key generation size.
    Returns:
      The key generation size.

  - ### getKeyPairGenerationScheme

    public String getKeyPairGenerationScheme()
    Returns the key pair generation scheme.
    Returns:
      The key pair generation scheme.

  - ### getKeyPairGenerationSize

    public int getKeyPairGenerationSize()
    Returns the key pair generation size.
    Returns:
      The key pair generation size.

  - ### getSecureRandomAlgorithm

    public String getSecureRandomAlgorithm()
    Returns the secure random algorithm.
    Returns:
      The secure random algorithm.

  - ### getHmacAlgorithm

    public String getHmacAlgorithm()
    Returns the HMAC algorithm.
    Returns:
      The HMAC algorithm.

  - ### getMessageDigestAlgorithm

    public String getMessageDigestAlgorithm()
    Returns the message digest algorithm.
    Returns:
      The message digest algorithm.

  - ### getMessageDigestSignatureAlgorithm

    public String getMessageDigestSignatureAlgorithm()
    Returns the message digest signature algorithm.
    Returns:
      The message digest signature algorithm.

  - ### getKeyAgreementAlgorithm

    public String getKeyAgreementAlgorithm()
    Returns the key agreement algorithm.
    Returns:
      The key agreement algorithm.

  - ### getKeyAgreementKeyPairGenerationScheme

    public String getKeyAgreementKeyPairGenerationScheme()
    Returns the key pair generation scheme for key agreement algorithm.
    Returns:
      The key pair generation scheme for key agreement algorithm.

  - ### getdhModulusSize

    public int getdhModulusSize()
    Returns the Diffie-Hellman random exponent size.
    Returns:
      The Diffie-Hellman random exponent size.

  - ### getEcGenParameterSpec

    public String getEcGenParameterSpec()
    Returns the Elliptic Curve.
    Returns:
      The Elliptic Curve

  - ### getAsymCipherSchemeBlock

    public String getAsymCipherSchemeBlock()
    Returns the asymmetric cipher scheme block.
    Returns:
      The asymmetric cipher scheme block.

  - ### getSslContext

    public String getSslContext()
    Returns the SSL context.
    Returns:
      The SSL context.

  - ### getAsymKeyTypeToCipherMap

    public Map<String,String> getAsymKeyTypeToCipherMap()
    Returns the asymmetric Key type to Cipher Map
    Returns:
      the asymmetric Key type to Cipher Map

  - ### getAsymKeyTypeToSignatureMap

    public Map<String,String> getAsymKeyTypeToSignatureMap()
    Returns the asymmetric Key type to Signature Map
    Returns:
      the asymmetric Key type to Signature Map

  - ### getSecurityProvider

    public String getSecurityProvider()
    Returns the global security provider.
    Returns:
      The global security provider.

  - ### getCipherSchemeProvider

    public String getCipherSchemeProvider()
    Returns the provider for the cipher scheme.
    Returns:
      The provider for the cipher scheme.

  - ### getkeyGenerationSchemeProvider

    public String getkeyGenerationSchemeProvider()
    Returns the provider for key generation.
    Returns:
      The provider for key generation.

  - ### getkeyGenerationSchemePBEProvider

    public String getkeyGenerationSchemePBEProvider()
    Returns the provider for PBE key generation.
    Returns:
      The provider for PBE key generation.

  - ### getKeyPairGenerationProvider

    public String getKeyPairGenerationProvider()
    Returns the provider for key pair generation.
    Returns:
      The provider for key pair generation.

  - ### getSecureRandomProvider

    public String getSecureRandomProvider()
    Returns the provider for secure random algorithm.
    Returns:
      The provider for secure random algorithm.

  - ### getHmacProvider

    public String getHmacProvider()
    Returns the provider for HMAC algorithm.
    Returns:
      The provider for HMAC algorithm.

  - ### getMessageDigestProvider

    public String getMessageDigestProvider()
    Returns the provider for message digest algorithm.
    Returns:
      The provider for message digest algorithm.

  - ### getSignatureProvider

    public String getSignatureProvider()
    Returns the provider for signature algorithm.
    Returns:
      The provider for signature algorithm.

  - ### getAsymEncProvider

    public String getAsymEncProvider()
    Returns the provider for asymmetric encryption algorithm.
    Returns:
      The provider for asymmetric encryption algorithm.

  - ### getKeyAgreementProvider

    public String getKeyAgreementProvider()
    Returns the provider for key agreement algorithm.
    Returns:
      The provider for key agreement algorithm.

  - ### getSslContextProvider

    public String getSslContextProvider()
    Returns the provider for SSL context.
    Returns:
      The provider for SSL context.