Package io.jsondb.crypto
Class Default1Cipher
- java.lang.Object
-
- io.jsondb.crypto.Default1Cipher
-
- All Implemented Interfaces:
ICipher
public class Default1Cipher extends java.lang.Object implements ICipher
A default AES (GCM Mode) Cipher. AES is a 128-bit block cipher supporting keys of 128, 192, and 256 bits. The constructors do not check if key provided as parameter indeed specifies a valid AES key. It does not check key size, nor does it check for weak or sem-weak keys. Note: If you want to use Key > 128 bits then you need to install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy files.
-
-
Constructor Summary
Constructors Constructor Description Default1Cipher(byte[] encryptionKey)Creates a new default cipher using 'UTF-8' encoding and key.Default1Cipher(byte[] encryptionKey, java.nio.charset.Charset charset)Creates a new default cipher with the specified charset encoding and key.Default1Cipher(java.lang.String base64CodedEncryptionKey)Creates a new default cipher using 'UTF-8' encoding, with a base64-encoded key.Default1Cipher(java.lang.String base64CodedEncryptionKey, java.nio.charset.Charset charset)Creates a new default cipher with the specified charset encoding, with a base64-encoded key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringdecrypt(java.lang.String cipherText)A method to decrypt the provided cipher text.java.lang.Stringencrypt(java.lang.String plainText)This method is used to encrypt(Symmetric) plainText coming in input using AES algorithm
-
-
-
Constructor Detail
-
Default1Cipher
public Default1Cipher(java.lang.String base64CodedEncryptionKey) throws java.security.GeneralSecurityExceptionCreates a new default cipher using 'UTF-8' encoding, with a base64-encoded key.- Parameters:
base64CodedEncryptionKey- A base 64 encoded symmetric key to be used during encryption and decryption.- Throws:
java.security.GeneralSecurityException- a general security exception
-
Default1Cipher
public Default1Cipher(byte[] encryptionKey) throws java.security.GeneralSecurityExceptionCreates a new default cipher using 'UTF-8' encoding and key.- Parameters:
encryptionKey- A symmetric key to be used during encryption and decryption.- Throws:
java.security.GeneralSecurityException- a general security exception
-
Default1Cipher
public Default1Cipher(java.lang.String base64CodedEncryptionKey, java.nio.charset.Charset charset) throws java.security.GeneralSecurityExceptionCreates a new default cipher with the specified charset encoding, with a base64-encoded key.- Parameters:
base64CodedEncryptionKey- A base 64 encoded symmetric key to be used during encryption and decryption.charset- The charset to be considered when encrypting plaintext or decrypting ciphertext.- Throws:
java.security.GeneralSecurityException- a general security exception
-
Default1Cipher
public Default1Cipher(byte[] encryptionKey, java.nio.charset.Charset charset) throws java.security.GeneralSecurityExceptionCreates a new default cipher with the specified charset encoding and key.- Parameters:
encryptionKey- A symmetric key to be used during encryption and decryption.charset- The charset to be considered when encrypting plaintext or decrypting ciphertext.- Throws:
java.security.GeneralSecurityException- a general security exception
-
-