public class CryptoScheme extends Object
| Constructor and Description |
|---|
CryptoScheme(String keyFactoryName,
String cipherName,
String password)
Tries to initialize the crypto-scheme with user-provided parameters
|
| Modifier and Type | Method and Description |
|---|---|
String |
encrypt(String plaintext)
Encrypts plaintext and returns it as a hex-encoded String (2 chars per byte of cipher-text)
|
public CryptoScheme(String keyFactoryName, String cipherName, String password) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidKeyException
keyFactoryName - key factory name for key generationcipherName - name of the cipherpassword - password for key generationNoSuchAlgorithmException - in case of the provided cipherName is not representing a valid algorithmNoSuchPaddingException - in case of a padding technology is used that cannot be foundInvalidKeySpecException - in case of a failure in the key specificationInvalidKeyException - in case of a failure in the keypublic String encrypt(String plaintext) throws GeneralSecurityException
plaintext - source String to encryptGeneralSecurityException - in case of a general security processing or encryption failureCopyright © 2016–2019 AdroitLogic. All rights reserved.