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 Summary
FieldsModifier and TypeFieldDescriptionstatic final Charset
The standard encoding for encrypted strings. -
Method Summary
Modifier and TypeMethodDescriptiondecryptString
(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm, PrivateKey privateKey, String input) Decrypts the given string from hex format into decrypted format.default String
encrypt
(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm, PublicKey publicKey, String input) Encrypts the given String and transforms it to thegetCipher
(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm) Gets theCipher
instance used to operate
-
Field Details
-
STANDARD_ENCODING
The standard encoding for encrypted strings.
-
-
Method Details
-
getCipher
Gets theCipher
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 usepublicKey
- the public key to useinput
- 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 useprivateKey
- the private key to useinput
- the input string- Returns:
- the decrypted string
-