Class BouncyCastleProvider

java.lang.Object
org.qubership.atp.crypt.provider.BouncyCastleProvider
All Implemented Interfaces:
CryptoProvider

public class BouncyCastleProvider extends Object implements CryptoProvider
The Bouncy Castle provider.
  • Constructor Details

    • BouncyCastleProvider

      public BouncyCastleProvider()
  • Method Details

    • generateKeys

      public KeyEntity generateKeys() throws Exception
      Description copied from interface: CryptoProvider
      Generate Keys.
      Specified by:
      generateKeys in interface CryptoProvider
      Returns:
      KeyEntity containing generated keys
      Throws:
      Exception - in case some encryption problems.
    • readPublicKey

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

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

      public Object readKey(String key) throws Exception
      Description copied from interface: CryptoProvider
      Read key from string parameter.
      Specified by:
      readKey in interface CryptoProvider
      Parameters:
      key - String to read key
      Returns:
      Object - key read
      Throws:
      Exception - in case some encryption problems.
    • encrypt

      public String encrypt(String transformation, String data, Object key) throws Exception
      Description copied from interface: CryptoProvider
      Encrypt String data using transformation and key provided.
      Specified by:
      encrypt in interface CryptoProvider
      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.
    • isEncrypted

      public boolean isEncrypted(String data)
      Check that string is encrypted.
      Specified by:
      isEncrypted in interface CryptoProvider
      Parameters:
      data - data
      Returns:
      true or false
    • decrypt

      public String decrypt(String transformation, String data, Object key) throws Exception
      Description copied from interface: CryptoProvider
      Decrypt String data using transformation and key provided.
      Specified by:
      decrypt in interface CryptoProvider
      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.