Class CryptoServiceImpl
Object
CryptoServiceImpl
- All Implemented Interfaces:
CryptoService
Thread-safe concrete implementation of
CryptoService
.-
Nested Class Summary
Nested classes/interfaces inherited from interface CryptoService
CryptoService.DecryptBytesHolder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecryptBytes
(String jweToken) Decrypt a Compact JWE that is already in RAM.decryptFile
(Path input, Path output) decryptFileStream
(Path input, Path output) encryptBytes
(String kid, byte[] plaintext) Encrypt raw bytes with a server-side **public** key.encryptFile
(String kid, Path input, Path output) encryptFileStream
(String kid, Path input, Path output) reencryptBytes
(String newKid, String jweToken) Re-encrypt a JWE in memory so it becomes protected bynewKid
.reencryptFile
(String newKid, Path input, Path output) reencryptFileStream
(String newKid, Path input, Path output)
-
Constructor Details
-
CryptoServiceImpl
public CryptoServiceImpl(AnkaSecureOpenApiClient api)
-
-
Method Details
-
encryptFile
- Specified by:
encryptFile
in interfaceCryptoService
-
decryptFile
- Specified by:
decryptFile
in interfaceCryptoService
-
reencryptFile
- Specified by:
reencryptFile
in interfaceCryptoService
-
encryptFileStream
- Specified by:
encryptFileStream
in interfaceCryptoService
-
decryptFileStream
- Specified by:
decryptFileStream
in interfaceCryptoService
-
reencryptFileStream
- Specified by:
reencryptFileStream
in interfaceCryptoService
-
encryptBytes
Encrypt raw bytes with a server-side **public** key.- Specified by:
encryptBytes
in interfaceCryptoService
- Parameters:
kid
- key ID in the platform (must not benull
)plaintext
- data to protect (must not benull
)- Returns:
EncryptFileResult
exposing the Compact JWE token and metadata
-
decryptBytes
Decrypt a Compact JWE that is already in RAM.- Specified by:
decryptBytes
in interfaceCryptoService
- Parameters:
jweToken
- textual Compact JWE (UTF-8, not Base64 wrapped)- Returns:
CryptoService.DecryptBytesHolder
containing plaintext and metadata
-
reencryptBytes
Re-encrypt a JWE in memory so it becomes protected bynewKid
.- Specified by:
reencryptBytes
in interfaceCryptoService
- Parameters:
newKid
- key that must protect the data after rotationjweToken
- current Compact JWE (text form)- Returns:
- metadata for old/new keys plus the refreshed JWE token
-