Interface CipherUtility

All Known Implementing Classes:
StandardCipherUtility

public interface CipherUtility
Deals with instances of Cipher as well as provides some standard utilities for encrypting data.
  • Field Details

    • STANDARD_ENCODING

      static final Charset STANDARD_ENCODING
      The standard encoding for encrypted strings.
  • Method Details

    • getCipher

      Cipher getCipher(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm)
      Gets the Cipher instance used to operate
      Parameters:
      privateKeyCrytpoAlgorithm -
      Returns:
    • encrypt

      default String encrypt(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm, PublicKey publicKey, String input)
      Encrypts the given String and transforms it to the
      Parameters:
      privateKeyCrytpoAlgorithm - the algorithm to use
      publicKey - the public key to use
      input - the input string
      Returns:
      the encrypted string
    • decryptString

      default Optional<String> decryptString(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm, PrivateKey privateKey, String input)
      Decrypts the given string from hex format into decrypted format.
      Parameters:
      privateKeyCrytpoAlgorithm - the algorithm to use
      privateKey - the private key to use
      input - the input string
      Returns:
      the decrypted string