public class ERXCrypto
extends java.lang.Object
| Properties | |
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 java.lang.String |
AES
The constant for the AES encryption algorithm.
|
static java.lang.String |
BLOWFISH
The constant for the Blowfish encryption algorithm.
|
static java.lang.String |
DES
The constant for the DES encryption algorithm.
|
static org.apache.log4j.Logger |
log
logging support
|
| Constructor and Description |
|---|
ERXCrypto() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
algorithmEncode(java.lang.String text,
java.lang.String algorithmName)
Encodes a given string with a given algorithm.
|
static byte[] |
base64Decode(java.lang.String s)
Base64 decodes the passed in String
|
static java.lang.String |
base64Encode(byte[] byteArray)
Base64 encodes the passed in byte[]
|
static java.lang.String |
base64EncryptedString(java.lang.String clearText)
Deprecated.
use ERXDESCrypter and/or
ERXCrypto.crypterForAlgorithm(ERXCrypto.DES)
|
static java.lang.String |
base64EncryptedString(java.lang.String clearText,
java.security.Key secretKey)
Deprecated.
use ERXDESCrypter and/or
ERXCrypto.crypterForAlgorithm(ERXCrypto.DES)
|
static java.lang.String |
base64HashedString(java.lang.String v)
Uses the SHA hash algorithm found in the Sun JCE to hash the passed in
String.
|
static byte[] |
base64urlDecode(java.lang.String s)
Deprecated.
|
static java.lang.String |
base64urlEncode(byte[] byteArray)
Base64url encodes the passed in byte[]
|
static java.lang.String |
blowfishDecode(java.lang.String encryptedText)
Deprecated.
use ERXBlowfishCrypter and/or
ERXCrypto.crypterForAlgorithm(ERXCrypto.BLOWFISH)
|
static java.lang.String |
blowfishEncode(java.lang.String clearText)
Deprecated.
use ERXBlowfishCrypter and/or
ERXCrypto.crypterForAlgorithm(ERXCrypto.BLOWFISH)
|
static java.lang.String |
bytesToString(byte[] bytes)
Deprecated.
|
static ERXCrypterInterface |
crypterForAlgorithm(java.lang.String algorithm)
Returns the crypter for the given algorithm.
|
static NSMutableDictionary<java.lang.String,java.lang.String> |
decodedFormValuesDictionary(NSDictionary<java.lang.String,NSArray<java.lang.String>> dict)
Decodes all of the values from a given dictionary using the default
crypter.
|
static java.lang.String |
decryptedBase64String(java.lang.String encryptedText)
Deprecated.
use ERXDESCrypter and/or
ERXCrypto.crypterForAlgorithm(ERXCrypto.DES)
|
static java.lang.String |
decryptedBase64String(java.lang.String encryptedText,
java.security.Key secretKey)
Deprecated.
use ERXDESCrypter and/or
ERXCrypto.crypterForAlgorithm(ERXCrypto.DES)
|
static ERXCrypterInterface |
defaultCrypter()
Returns the default crypter.
|
static void |
main(java.lang.String[] args)
Run this with ERXMainRunner passing in the plaintext you want to encrypt
using the default crypter.
|
static java.lang.String |
md5Encode(java.lang.String text)
MD5 encodes a given string.
|
static void |
setCrypterForAlgorithm(ERXCrypterInterface crypter,
java.lang.String algorithm)
Sets the crypter for the given algorithm.
|
static void |
setSecretKeyPath(java.lang.String secretKeyPath)
Deprecated.
use ERXDESCrypter and/or
ERXCrypto.crypterForAlgorithm(ERXCrypto.DES)
|
static void |
setSecretKeyPathFramework(java.lang.String secretKeyPathFramework)
Deprecated.
use ERXDESCrypter and/or
ERXCrypto.crypterForAlgorithm(ERXCrypto.DES)
|
static java.lang.String |
sha256Encode(java.lang.String text)
SHA-256 encodes a given string.
|
static java.lang.String |
sha384Encode(java.lang.String text)
SHA-384 encodes a given string.
|
static java.lang.String |
sha512Encode(java.lang.String text)
SHA-512 encodes a given string.
|
static java.lang.String |
shaEncode(java.lang.String text)
SHA-1 encodes a given string.
|
public static final org.apache.log4j.Logger log
public static final java.lang.String DES
public static final java.lang.String BLOWFISH
public static final java.lang.String AES
public static ERXCrypterInterface defaultCrypter()
public static void setCrypterForAlgorithm(ERXCrypterInterface crypter, java.lang.String algorithm)
crypter - the crypter to usealgorithm - the algorithm namepublic static ERXCrypterInterface crypterForAlgorithm(java.lang.String algorithm)
algorithm - the algorithm to lookupjava.lang.IllegalArgumentException - if there is no crypter for the given algorithmpublic static NSMutableDictionary<java.lang.String,java.lang.String> decodedFormValuesDictionary(NSDictionary<java.lang.String,NSArray<java.lang.String>> dict)
dict - dictionary of key value pairs where the values are encoded
stringspublic static java.lang.String base64HashedString(java.lang.String v)
v - the string to encodepublic static java.lang.String shaEncode(java.lang.String text)
text - to be put through the sha digestpublic static java.lang.String sha256Encode(java.lang.String text)
text - to be put through the sha digestpublic static java.lang.String sha384Encode(java.lang.String text)
text - to be put through the sha digestpublic static java.lang.String sha512Encode(java.lang.String text)
text - to be put through the sha digestpublic static java.lang.String md5Encode(java.lang.String text)
text - to be put through the sha digestpublic static java.lang.String algorithmEncode(java.lang.String text,
java.lang.String algorithmName)
text - to be put through the algorithm digestalgorithmName - the algorithm to use (e.g. SHA, SHA-256, ...)public static java.lang.String base64Encode(byte[] byteArray)
byteArray - the byte array to encodepublic static java.lang.String base64urlEncode(byte[] byteArray)
byteArray - the byte array to URL encodepublic static byte[] base64Decode(java.lang.String s)
throws java.io.IOException
s - the string to decodejava.io.IOException - if the decode fails@Deprecated
public static byte[] base64urlDecode(java.lang.String s)
throws java.io.IOException
base64Decode(String)s - the string to URL decodejava.io.IOException - if the decode fails@Deprecated public static java.lang.String bytesToString(byte[] bytes)
ERXStringUtilities.byteArrayToHexString(byte[])@Deprecated public static java.lang.String base64EncryptedString(java.lang.String clearText)
@Deprecated
public static java.lang.String base64EncryptedString(java.lang.String clearText,
java.security.Key secretKey)
@Deprecated public static java.lang.String decryptedBase64String(java.lang.String encryptedText)
@Deprecated
public static java.lang.String decryptedBase64String(java.lang.String encryptedText,
java.security.Key secretKey)
@Deprecated public static java.lang.String blowfishEncode(java.lang.String clearText)
@Deprecated public static java.lang.String blowfishDecode(java.lang.String encryptedText)
@Deprecated public static void setSecretKeyPathFramework(java.lang.String secretKeyPathFramework)
@Deprecated public static void setSecretKeyPath(java.lang.String secretKeyPath)
public static void main(java.lang.String[] args)
args - the plaintext to encryptCopyright © 2002 – 2022 Project Wonder.