Interface CryptoProvider

All Known Implementing Classes:
BouncyCastleProvider

public interface CryptoProvider
  • Method Details

    • generateKeys

      KeyEntity generateKeys() throws Exception
      Generate Keys.
      Returns:
      KeyEntity containing generated keys
      Throws:
      Exception - in case some encryption problems.
    • readPublicKey

      Object readPublicKey(String publicKey) throws Exception
      Read public key from string parameter.
      Parameters:
      publicKey - String to read key
      Returns:
      Object - public key read
      Throws:
      Exception - in case some encryption problems.
    • readPrivateKey

      Object readPrivateKey(String privateKey) throws Exception
      Read private key from string parameter.
      Parameters:
      privateKey - String to read key
      Returns:
      Object - private key read
      Throws:
      Exception - in case some encryption problems.
    • readKey

      Object readKey(String key) throws Exception
      Read key from string parameter.
      Parameters:
      key - String to read key
      Returns:
      Object - key read
      Throws:
      Exception - in case some encryption problems.
    • encrypt

      String encrypt(String transformation, String data, Object key) throws Exception
      Encrypt String data using transformation and key provided.
      Parameters:
      transformation - Name of transformation, as used in javax.crypto.Cipher
      data - String to be encrypted
      key - Key object
      Returns:
      String - encrypted String
      Throws:
      Exception - in case some encryption problems.
    • decrypt

      String decrypt(String transformation, String data, Object key) throws Exception
      Decrypt String data using transformation and key provided.
      Parameters:
      transformation - Name of transformation, as used in javax.crypto.Cipher
      data - String to be decrypted
      key - Key object
      Returns:
      String - decrypted String
      Throws:
      Exception - in case some encryption problems.
    • isEncrypted

      boolean isEncrypted(String data)
      Check if String data parameter is encrypted or not.
      Parameters:
      data - String to check
      Returns:
      true if String is encrypted, otherwise false.