Package com.reve.utils.encryption
Class EncryptionDecryption
java.lang.Object
com.reve.utils.encryption.EncryptionDecryption
This is a class for encrypting data and decrypting the encrypted data
- Since:
- 22 Feb, 2023
- Author:
- Md. Nazmul Hasan
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
EncryptionDecryption
public EncryptionDecryption()
-
-
Method Details
-
encrypt
Get a string and convert it to byte and do xor operation with key. Then encoded it with base64 encoder key length may be not equal to the data so just do mod operation with key length while doing xor operation- Parameters:
data- this is the data that we want to encrypt- Returns:
- encrypted data in base64 encoded format
-
decrypt
This function will decrypt the encrypted data. First, decode the encrypted data with base64 decoder do xor operation with key key length may be not equal to the data so just do mod operation with key length while doing xor operation then get plain text as byte array converting it as string may have extra space so trim it- Parameters:
encryptedData- this is the encrypted data we want to decrypt- Returns:
- plaintext as string
-