Package org.saidone.service.crypto
Interface CryptoService
- All Known Implementing Classes:
AbstractCryptoService
,BcCryptoServiceImpl
,JcaCryptoServiceImpl
public interface CryptoService
Abstraction for stream based symmetric encryption and decryption services.
Implementations return
InputStream
instances that must be consumed
and closed by the caller. Concrete implementations include
JcaCryptoServiceImpl
and BcCryptoServiceImpl
.-
Method Summary
Modifier and TypeMethodDescriptiondecrypt
(InputStream inputStream) Decrypts an encrypted data stream.decryptText
(String encryptedText) Decrypts a Base64 encoded encrypted text value.encrypt
(InputStream inputStream) Encrypts the provided data stream.encryptText
(String text) Encrypts a text value and returns the Base64 encoded result.
-
Method Details
-
encrypt
Encrypts the provided data stream.- Parameters:
inputStream
- plaintext data to encrypt- Returns:
- a stream containing the encrypted data
-
decrypt
Decrypts an encrypted data stream.- Parameters:
inputStream
- the encrypted data- Returns:
- a stream yielding the decrypted plaintext
-
encryptText
Encrypts a text value and returns the Base64 encoded result.- Parameters:
text
- the text to encrypt- Returns:
- encrypted text encoded in Base64
-
decryptText
Decrypts a Base64 encoded encrypted text value.- Parameters:
encryptedText
- the Base64 encoded encrypted text- Returns:
- the decrypted plain text
-