public class HexNewEncryptor extends BaseEncryptor<String,String>
cipher| Constructor and Description |
|---|
HexNewEncryptor(String privateKey)
Default constructor.
|
HexNewEncryptor(String privateKey,
Algorithm algorithm)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
encrypt(String string)
Encrypt the given String.
|
protected String |
newAlgorithm()
Factory method for creating a new algorithm that will be used with the cipher object.
|
protected Cipher |
newCipher(String privateKey,
String algorithm,
byte[] salt,
int iterationCount,
int operationMode)
Factory method for creating a new
Cipher from the given parameters. |
newOperationModenewAlgorithmParameterSpec, newCipher, newCipher, newIterationCount, newKeySpec, newSalt, newSecretKeyFactory, onInitializepublic HexNewEncryptor(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.UnsupportedEncodingException - is thrown if the named charset is not supported.public HexNewEncryptor(String privateKey, Algorithm algorithm) throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidAlgorithmParameterException, UnsupportedEncodingException
privateKey - The private key.algorithm - the algorithmInvalidAlgorithmParameterException - 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.UnsupportedEncodingException - is thrown if the named charset is not supported.public String encrypt(String string) throws InvalidKeyException, UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException
string - The String to encrypt.InvalidKeyException - the invalid key exception is thrown if initialization of the cypher object fails.UnsupportedEncodingException - is thrown by get the byte array of the private key String object fails or if the named charset is not supported.NoSuchAlgorithmException - is thrown if instantiation of the cypher object fails.NoSuchPaddingException - is thrown if instantiation of the cypher object fails.IllegalBlockSizeException - is thrown if Cipher.doFinal(byte[]) fails.BadPaddingException - is thrown if Cipher.doFinal(byte[]) fails.protected String newAlgorithm()
AbstractCryptornewAlgorithm in class AbstractCryptorprotected Cipher newCipher(String privateKey, String algorithm, byte[] salt, int iterationCount, int operationMode) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, UnsupportedEncodingException
AbstractCryptorCipher 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 AbstractCryptorprivateKey - 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.Copyright © 2015–2016 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.