public class ERXCrypto extends Object
Name | Description |
---|---|
er.extensions.ERXCrypto.default | the name of the default crypter algorithm (default = "Blowfish") |
er.extensions.ERXCrypto.crypters | comma-separated list of crypter algorithms (i.e. "DES,Blowfish") |
er.extensions.ERXCrypto.crypter.[Algorithm] | crypter class name, should be one for each algorithm in crypters list (i.e. er.extensions.ERXCrypto.crypter.DES) |
Modifier and Type | Field and Description |
---|---|
static String |
AES
The constant for the AES encryption algorithm.
|
static String |
BLOWFISH
The constant for the Blowfish encryption algorithm.
|
static String |
DES
The constant for the DES encryption algorithm.
|
Constructor and Description |
---|
ERXCrypto() |
Modifier and Type | Method and Description |
---|---|
static String |
algorithmEncode(String text,
String algorithmName)
Encodes a given string with a given algorithm.
|
static byte[] |
base64Decode(String s)
Base64 decodes the passed in String
|
static String |
base64Encode(byte[] byteArray)
Base64 encodes the passed in byte[]
|
static String |
base64HashedString(String v)
Uses the SHA hash algorithm found in the Sun JCE to hash the passed in
String.
|
static String |
base64urlEncode(byte[] byteArray)
Base64url encodes the passed in byte[]
|
static ERXCrypterInterface |
crypterForAlgorithm(String algorithm)
Returns the crypter for the given algorithm.
|
static NSMutableDictionary<String,String> |
decodedFormValuesDictionary(NSDictionary<String,NSArray<String>> dict)
Decodes all of the values from a given dictionary using the default
crypter.
|
static ERXCrypterInterface |
defaultCrypter()
Returns the default crypter.
|
static void |
main(String[] args)
Run this with ERXMainRunner passing in the plaintext you want to encrypt
using the default crypter.
|
static String |
md5Encode(String text)
MD5 encodes a given string.
|
static void |
setCrypterForAlgorithm(ERXCrypterInterface crypter,
String algorithm)
Sets the crypter for the given algorithm.
|
static String |
sha256Encode(String text)
SHA-256 encodes a given string.
|
static String |
sha384Encode(String text)
SHA-384 encodes a given string.
|
static String |
sha512Encode(String text)
SHA-512 encodes a given string.
|
static String |
shaEncode(String text)
SHA-1 encodes a given string.
|
public static final String DES
public static final String BLOWFISH
public static final String AES
public static ERXCrypterInterface defaultCrypter()
public static void setCrypterForAlgorithm(ERXCrypterInterface crypter, String algorithm)
crypter
- the crypter to usealgorithm
- the algorithm namepublic static ERXCrypterInterface crypterForAlgorithm(String algorithm)
algorithm
- the algorithm to lookupIllegalArgumentException
- if there is no crypter for the given algorithmpublic static NSMutableDictionary<String,String> decodedFormValuesDictionary(NSDictionary<String,NSArray<String>> dict)
dict
- dictionary of key value pairs where the values are encoded
stringspublic static String base64HashedString(String v)
v
- the string to encodepublic static String shaEncode(String text)
text
- to be put through the sha digestpublic static String sha256Encode(String text)
text
- to be put through the sha digestpublic static String sha384Encode(String text)
text
- to be put through the sha digestpublic static String sha512Encode(String text)
text
- to be put through the sha digestpublic static String md5Encode(String text)
text
- to be put through the sha digestpublic static String algorithmEncode(String text, String algorithmName)
text
- to be put through the algorithm digestalgorithmName
- the algorithm to use (e.g. SHA, SHA-256, ...)public static String base64Encode(byte[] byteArray)
byteArray
- the byte array to encodepublic static String base64urlEncode(byte[] byteArray)
byteArray
- the byte array to URL encodepublic static byte[] base64Decode(String s) throws IOException
s
- the string to decodeIOException
- if the decode failspublic static void main(String[] args)
args
- the plaintext to encryptCopyright © 2002 – 2020 Project Wonder.