public class CryptoSuite extends Object
Constructor and Description |
---|
CryptoSuite(CryptoManager cryptoManager,
String cipherTransformation,
int cipherKeyLength,
boolean encrypt)
Declares a new CryptoSuite with provided parameters.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
decrypt(byte[] data)
Decrypts data using the key specified in the prologue.
|
byte[] |
encrypt(byte[] data)
Encrypts data with the configured cipher transformation and key length.
|
CipherOutputStream |
getCipherOutputStream(OutputStream os)
Returns a
CipherOutputStream for encrypting through a sequence of OutputStreams. |
ByteString |
hash48(ByteSequence data)
Returns a ByteString of 6 bytes hash of the data.
|
boolean |
isEncrypted()
Returns whether the user of the crypto suite needs encryption.
|
void |
newParameters(String cipherTransformation,
int cipherKeyLength,
boolean enabled)
Set new cipher and enable parameters for the crypto suite.
|
String |
toString() |
public CryptoSuite(CryptoManager cryptoManager, String cipherTransformation, int cipherKeyLength, boolean encrypt)
cryptoManager
- the CryptoManager to use for cryptographic operationscipherTransformation
- the initial cipher transformationcipherKeyLength
- the initial key length for the cipherencrypt
- if the user of the crypto suite needs encryptionpublic void newParameters(String cipherTransformation, int cipherKeyLength, boolean enabled)
cipherTransformation
- the new cipher transformationcipherKeyLength
- the new key lengthenabled
- true if the user of the crypto suite needs encryptionpublic byte[] decrypt(byte[] data) throws GeneralSecurityException, CryptoManagerException
data
- the cipher-text to be decrypted (contains prologue)GeneralSecurityException
- if a problem occurs while decrypting the dataCryptoManagerException
- if a problem occurs during cipher initializationpublic byte[] encrypt(byte[] data) throws GeneralSecurityException, CryptoManagerException
data
- the clear-text data to encryptGeneralSecurityException
- if a problem occurs while encrypting the dataCryptoManagerException
- if a problem occurs during cipher initializationpublic CipherOutputStream getCipherOutputStream(OutputStream os) throws CryptoManagerException
CipherOutputStream
for encrypting through a sequence of OutputStreams.os
- the up-link OutputStreamCipherOutputStream
for encrypting through a sequence of OutputStreamsCryptoManagerException
- if a problem occurs during cipher initializationpublic ByteString hash48(ByteSequence data) throws DecodeException
data
- a ByteSequence containing the input data to be hashedDecodeException
- if digest of the data cannot be computedpublic boolean isEncrypted()
Copyright 2010-2022 ForgeRock AS.