public class PrivateKeyDecryptor extends AbstractDecryptor<Cipher,PrivateKey> implements de.alpharogroup.crypto.api.ByteArrayDecryptor
PrivateKeyDecryptor decrypts encrypted byte array the was encrypted with the
public key of the pendant private key of this class.model| Constructor and Description |
|---|
PrivateKeyDecryptor(de.alpharogroup.crypto.model.CryptModel<Cipher,PrivateKey> model)
Instantiates a new
PrivateKeyDecryptor with the given CryptModel. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] encrypted) |
protected String |
newAlgorithm()
Factory method for creating a new algorithm that will be used with the cipher object.
|
protected Cipher |
newCipher(PrivateKey key,
String algorithm,
byte[] salt,
int iterationCount,
int operationMode)
Factory method for creating a new
Cipher from the given parameters. |
newOperationModenewAlgorithmParameterSpec, newCipher, newIterationCount, newSalt, newSecretKeyFactory, onInitializepublic PrivateKeyDecryptor(de.alpharogroup.crypto.model.CryptModel<Cipher,PrivateKey> model) throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidAlgorithmParameterException, UnsupportedEncodingException
PrivateKeyDecryptor with the given 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 byte[] decrypt(byte[] encrypted)
throws Exception
decrypt in interface de.alpharogroup.crypto.api.Decryptor<byte[],byte[]>Exceptionprotected String newAlgorithm()
newAlgorithm in class AbstractCryptor<Cipher,PrivateKey>protected Cipher newCipher(PrivateKey key, 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,PrivateKey>key - the 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.Copyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.