public abstract class AbstractFileEncryptor extends AbstractEncryptor<Cipher,String> implements de.alpharogroup.crypto.api.FileEncryptor
AbstractFileEncryptor provides a base implementation for encrypting
File objects.model| Constructor and Description |
|---|
AbstractFileEncryptor(de.alpharogroup.crypto.model.CryptModel<Cipher,String> model)
Constructor with the given
CryptModel. |
AbstractFileEncryptor(String privateKey)
Constructor with a private key.
|
| Modifier and Type | Method and Description |
|---|---|
protected Cipher |
newCipher(int operationMode,
SecretKey key,
AlgorithmParameterSpec paramSpec,
String alg)
Factory method for creating a new
Cipher from the given parameters. |
protected Cipher |
newCipher(String privateKey,
String algorithm,
byte[] salt,
int iterationCount,
int operationMode)
Factory method for creating a new
Cipher from the given parameters. |
protected KeySpec |
newKeySpec(String privateKey,
byte[] salt,
int iterationCount)
Factory method for creating a new
KeySpec from the given private key. |
newOperationModenewAlgorithm, newAlgorithmParameterSpec, newCipher, newIterationCount, newSalt, newSecretKeyFactory, onInitializepublic AbstractFileEncryptor(de.alpharogroup.crypto.model.CryptModel<Cipher,String> model) throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidAlgorithmParameterException, UnsupportedEncodingException
CryptModel.model - The crypt model.InvalidAlgorithmParameterException - is thrown if initialization of the cypher object fails.NoSuchPaddingException - is thrown if instantiation of the SecretKeyFactory object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.NoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.InvalidKeyException - is thrown if initialization of the cypher object fails.NoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.UnsupportedEncodingException - is thrown if the named charset is not supported.public AbstractFileEncryptor(String privateKey) throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidAlgorithmParameterException, UnsupportedEncodingException
privateKey - The private key.InvalidAlgorithmParameterException - is thrown if initialization of the cypher object fails.NoSuchPaddingException - is thrown if instantiation of the SecretKeyFactory object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.NoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.InvalidKeyException - is thrown if initialization of the cypher object fails.NoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.UnsupportedEncodingException - is thrown if the named charset is not supported.protected Cipher newCipher(int operationMode, SecretKey key, AlgorithmParameterSpec paramSpec, String alg) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException
Cipher from the given parameters. This method is
invoked in the constructor from the derived classes and can be overridden so users can
provide their own version of a new Cipher from the given parameters.operationMode - the operation modekey - the keyparamSpec - the param specalg - the algNoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.NoSuchPaddingException - is thrown if instantiation of the cypher object fails.InvalidKeyException - is thrown if initialization of the cypher object fails.InvalidAlgorithmParameterException - is thrown if initialization of the cypher object fails.protected Cipher newCipher(String privateKey, String algorithm, byte[] salt, int iterationCount, int operationMode) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, UnsupportedEncodingException
Cipher from the given parameters. This method is
invoked in the constructor from the derived classes and can be overridden so users can
provide their own version of a new Cipher from the given parameters.newCipher in class AbstractCryptor<Cipher,String>privateKey - the private keyalgorithm - the algorithmsalt - the salt.iterationCount - the iteration countoperationMode - the operation mode for the new cipher objectNoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.NoSuchPaddingException - is thrown if instantiation of the cypher object fails.InvalidKeyException - is thrown if initialization of the cypher object fails.InvalidAlgorithmParameterException - is thrown if initialization of the cypher object fails.UnsupportedEncodingException - is thrown if the named charset is not supported.protected KeySpec newKeySpec(String privateKey, byte[] salt, int iterationCount)
KeySpec from the given private key. This method is
invoked in the constructor from the derived classes and can be overridden so users can
provide their own version of a new KeySpec from the given private key.privateKey - the private keysalt - the saltiterationCount - the iteration countKeySpec from the given private key.Copyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.