public enum MaapiCryptoType extends Enum<MaapiCryptoType>
MaapiCrypto.| Modifier and Type | Method and Description |
|---|---|
String |
decrypt(byte[] key,
String encrypted)
Same as calling
MaapiCryptoType.decrypt(byte[], String, byte[]) with the iv
parameter set to null. |
String |
decrypt(byte[] key,
String encrypted,
byte[] iv)
Decrypt an encrypted string using the given key and IV.
|
String |
encrypt(byte[] key,
String plaintext)
Encrypt a plaintext string using a supplied key.
|
static MaapiCryptoType |
find(String encrypted)
Find the crypto type corresponding for an encrypted string.
|
boolean |
fixedIV(String value)
Check if an encrypted string was encrypted using a random or a fixed IV.
|
static boolean |
isEncrypted(String value)
Check if a string is encrypted or not based on the prefix of the string.
|
static MaapiCryptoType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static MaapiCryptoType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final MaapiCryptoType DES3
public static final MaapiCryptoType AES128
public static final MaapiCryptoType AES256
public static MaapiCryptoType[] values()
for (MaapiCryptoType c : MaapiCryptoType.values()) System.out.println(c);
public static MaapiCryptoType valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic boolean fixedIV(String value)
value - The encrypted string.public String encrypt(byte[] key, String plaintext) throws MaapiException
key - The key to use when encrypting the plaintext.plaintext - The plaintext value to encrypt.MaapiExceptionpublic String decrypt(byte[] key, String encrypted) throws MaapiException
MaapiCryptoType.decrypt(byte[], String, byte[]) with the iv
parameter set to null.MaapiExceptionpublic String decrypt(byte[] key, String encrypted, byte[] iv) throws MaapiException
key - The key to use for decryption.encrypted - The string to decrypt.iv - The fixed IV to use for decryption or null if the IV
is included in the encrypted string.MaapiExceptionpublic static final MaapiCryptoType find(String encrypted)
encrypted - The encrypted string to find the crypto type for.MaapiCryptoType object or null if the type could not
be found from the encrypted string.public static final boolean isEncrypted(String value)
value - The string to check if it is encrypted.