public class Crypto
extends java.lang.Object
Message payloads.| Modifier and Type | Class and Description |
|---|---|
static class |
Crypto.CipherParams
|
static interface |
Crypto.DecryptingChannelCipher
Internal; a cipher used to decrypt plaintext from ciphertext, for a channel.
|
static interface |
Crypto.EncryptingChannelCipher
Internal; a cipher used to encrypt plaintext to ciphertext, for a channel.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_ALGORITHM |
static int |
DEFAULT_BLOCKLENGTH |
static int |
DEFAULT_KEYLENGTH |
| Constructor and Description |
|---|
Crypto() |
| Modifier and Type | Method and Description |
|---|---|
static Crypto.CipherParams |
checkCipherParams(java.lang.Object cipherParams)
Internal; if `cipherParams` is null returns default params otherwise check if params valid and returns them
|
static Crypto.DecryptingChannelCipher |
createChannelDecipher(Crypto.CipherParams cipherParams)
Internal; get a decrypting cipher instance based on the given channel options.
|
static Crypto.EncryptingChannelCipher |
createChannelEncipher(Crypto.CipherParams cipherParams)
Internal; get an encrypting cipher instance based on the given channel options.
|
static byte[] |
generateRandomKey()
Generates a random key to be used in the encryption of the channel.
|
static byte[] |
generateRandomKey(int keyLength)
Generates a random key to be used in the encryption of the channel.
|
static Param |
generateRandomRequestId()
Returns a "request_id" query param, based on a sequence of 9 random bytes
which have been base64 encoded.
|
static Crypto.CipherParams |
getDefaultParams()
Spec: RSE1
|
static Crypto.CipherParams |
getDefaultParams(byte[] key)
Spec: RSE1
|
static Crypto.CipherParams |
getDefaultParams(java.lang.String base64Key)
Spec: RSE1
|
static Crypto.CipherParams |
getParams(java.lang.String algorithm,
byte[] key) |
static Crypto.CipherParams |
getParams(java.lang.String algorithm,
byte[] key,
byte[] iv) |
static Crypto.CipherParams |
getParams(java.lang.String algorithm,
int keyLength) |
static java.lang.String |
getRandomId() |
public static final java.lang.String DEFAULT_ALGORITHM
public static final int DEFAULT_KEYLENGTH
public static final int DEFAULT_BLOCKLENGTH
public static Crypto.CipherParams getDefaultParams()
Spec: RSE1
Crypto.CipherParams object, using the default values for all fields.public static Crypto.CipherParams getDefaultParams(byte[] key)
Spec: RSE1
key - client-provided keyCrypto.CipherParams object, using the default values for any fields not supplied.public static Crypto.CipherParams getDefaultParams(java.lang.String base64Key)
Spec: RSE1
base64Key - Base64-encoded keyCrypto.CipherParams object, using the default values for any fields not supplied.public static Crypto.CipherParams getParams(java.lang.String algorithm, int keyLength)
public static Crypto.CipherParams getParams(java.lang.String algorithm, byte[] key) throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmExceptionpublic static Crypto.CipherParams getParams(java.lang.String algorithm, byte[] key, byte[] iv) throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmExceptionpublic static byte[] generateRandomKey(int keyLength)
Spec: RSE2
keyLength - The length of the key, in bits, to be generated.
If not specified, this is equal to the default keyLength of the default algorithm: for AES this is 256 bits.public static byte[] generateRandomKey()
Spec: RSE2
public static Crypto.EncryptingChannelCipher createChannelEncipher(Crypto.CipherParams cipherParams) throws AblyException
AblyExceptionpublic static Crypto.DecryptingChannelCipher createChannelDecipher(Crypto.CipherParams cipherParams) throws AblyException
AblyExceptionpublic static Crypto.CipherParams checkCipherParams(java.lang.Object cipherParams) throws AblyException
AblyExceptionpublic static java.lang.String getRandomId()
public static Param generateRandomRequestId()