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.
|
CipherInputStream |
getCipherInputStream(InputStream is)
Returns a
CipherInputStream for decrypting through a sequence of InputStreams. |
CipherOutputStream |
getCipherOutputStream(OutputStream os)
Returns a
CipherOutputStream for encrypting through a sequence of
OutputStreams. |
org.forgerock.opendj.ldap.ByteString |
hash48(org.forgerock.opendj.ldap.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 CipherInputStream getCipherInputStream(InputStream is) throws CryptoManagerException
CipherInputStream
for decrypting through a sequence of InputStreams.is
- the up-link InputStreamCipherInputStream
for decrypting through a sequence of InputStreams.CryptoManagerException
- if a problem occurs during cipher initializationpublic org.forgerock.opendj.ldap.ByteString hash48(org.forgerock.opendj.ldap.ByteSequence data) throws org.forgerock.opendj.ldap.DecodeException
data
- a ByteSequence containing the input data to be hashedorg.forgerock.opendj.ldap.DecodeException
- if digest of the data cannot be computedpublic boolean isEncrypted()
Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.