public class OpenNLP183Encryption extends AbstractEncryption implements OpenNLPEncryption
OpenNLP160Encryption implementation. There is
a test in OpenNLP170EncryptionTest to ensure the compatibility.
IMPORTANT NOTE:
If you get an error like "java.security.InvalidKeyException: Illegal key size or default parameters" when trying to load and decrypt a model make sure you have the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for your JDK. Refer to: http://stackoverflow.com/a/6481658 and http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
You will NOT get this error when using OpenJDK!
| Constructor and Description |
|---|
OpenNLP183Encryption() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearKey()
Clears the encryption key.
|
String |
decrypt(String strToDecrypt)
Decrypt the input text.
|
String |
decrypt(String text,
String encryptionKey) |
String |
encrypt(String strToEncrypt)
Encrypt the input text.
|
String |
getKey() |
void |
setKey(String encryptionKey)
Sets the encryption key.
|
stringToBytespublic String encrypt(String strToEncrypt) throws Exception
OpenNLPEncryptionencrypt in interface OpenNLPEncryptionstrToEncrypt - The text to encrypt.Exception - Thrown if the text cannot be encrypted.public String decrypt(String strToDecrypt) throws Exception
OpenNLPEncryptiondecrypt in interface OpenNLPEncryptionstrToDecrypt - The text to decrypt.Exception - Thrown if the text cannot be decrypted.public void setKey(String encryptionKey)
OpenNLPEncryptionsetKey in interface OpenNLPEncryptionencryptionKey - The encryption key.public String getKey()
getKey in interface OpenNLPEncryptionpublic void clearKey()
OpenNLPEncryptionclearKey in interface OpenNLPEncryptionCopyright © 2018. All rights reserved.