Interface CryptoProvider


public interface CryptoProvider
CryptoProvider interface for cryptographic algorithm provider implementations.
Since:
0.1.0
Author:
Subhashni Balakrishnan
  • Method Details

    • getKeyStoreProvider

      KeyStoreProvider getKeyStoreProvider()
      Get the key store provider set for the crypto provider use.
      Returns:
      Key store provider set
    • setKeyStoreProvider

      void setKeyStoreProvider​(KeyStoreProvider provider)
      Set the key store provider for the crypto provider to get keys from.
      Parameters:
      provider - Key store provider
    • encrypt

      byte[] encrypt​(byte[] data) throws Exception
      Encrypts the given data. Will throw exceptions if the key store and key name are not set.
      Parameters:
      data - Data to be encrypted
      Returns:
      encrypted bytes
      Throws:
      Exception - on failure
    • getIVSize

      int getIVSize()
      Get the initialization vector size that prepended to the encrypted bytes
      Returns:
      iv size
    • decrypt

      byte[] decrypt​(byte[] encrypted) throws Exception
      Decrypts the given data. Will throw exceptions if the key store and key name are not set.
      Parameters:
      encrypted - Encrypted data
      Returns:
      decrypted bytes
      Throws:
      Exception - on failure
    • getSignature

      byte[] getSignature​(byte[] message) throws Exception
      Get the signature for the integrity check using the key given.
      Parameters:
      message - The message to check for correctness
      Returns:
      signature
      Throws:
      Exception - on failure
    • verifySignature

      boolean verifySignature​(byte[] message, byte[] signature) throws Exception
      verify the signature for the integrity check.
      Parameters:
      message - The message to check for correctness
      signature - Signature used for message
      Returns:
      True if success
      Throws:
      Exception - on failure
    • getProviderAlgorithmName

      String getProviderAlgorithmName()
      Get the crypto provider algorithm name
      Returns:
      provider algorithm name
    • getProviderName

      @Deprecated String getProviderName()
      Deprecated.
      Get the crypto provider algorithm name, not the alias used for registering
      Returns:
      provider algorithm name
    • checkAlgorithmNameMatch

      boolean checkAlgorithmNameMatch​(String name)
      Check if the algorithm name is a match
      Parameters:
      name - name to check
      Returns:
      true if there is a match
    • setAlias

      void setAlias​(String alias)
      Set the alias name on the provider
      Parameters:
      alias - alias for the provider