-
public class CryptoContains the properties required to configure the encryption of io.ably.lib.types.Message payloads.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classCrypto.CipherParamsSets the properties to configure encryption for a io.ably.lib.rest.Channel or io.ably.lib.realtime.Channel object.
public interfaceCrypto.EncryptingChannelCipherInternal; a cipher used to encrypt plaintext to ciphertext, for a channel.
public interfaceCrypto.DecryptingChannelCipherInternal; a cipher used to decrypt plaintext from ciphertext, for a channel.
-
Field Summary
Fields Modifier and Type Field Description public final static StringDEFAULT_ALGORITHMpublic final static intDEFAULT_KEYLENGTHpublic final static intDEFAULT_BLOCKLENGTH
-
Method Summary
Modifier and Type Method Description static Crypto.CipherParamsgetDefaultParams()Spec: RSE1 static Crypto.CipherParamsgetDefaultParams(Array<byte> key)Spec: RSE1 static Crypto.CipherParamsgetDefaultParams(String base64Key)Spec: RSE1 static Crypto.CipherParamsgetParams(String algorithm, int keyLength)static Crypto.CipherParamsgetParams(String algorithm, Array<byte> key)static Crypto.CipherParamsgetParams(String algorithm, Array<byte> key, Array<byte> iv)static Array<byte>generateRandomKey(int keyLength)Generates a random key to be used in the encryption of the channel.If the language cryptographic randomness primitives are blocking or async, a callback is used.The callback returns a generated binary key. static Array<byte>generateRandomKey()Generates a random key to be used in the encryption of the channel.If the language cryptographic randomness primitives are blocking or async, a callback is used.The callback returns a generated binary key. static Crypto.EncryptingChannelCiphercreateChannelEncipher(Crypto.CipherParams cipherParams)Internal; get an encrypting cipher instance based on the given channel options. static Crypto.DecryptingChannelCiphercreateChannelDecipher(Crypto.CipherParams cipherParams)Internal; get a decrypting cipher instance based on the given channel options. static Crypto.CipherParamscheckCipherParams(Object cipherParams)Internal; if `cipherParams` is null returns default params otherwise check if params valid and returns them static StringgetRandomId()static ParamgenerateRandomRequestId()Returns a "request_id" query param, based on a sequence of 9 random byteswhich have been base64 encoded. -
-
Method Detail
-
getDefaultParams
static Crypto.CipherParams getDefaultParams()
Spec: RSE1
-
getDefaultParams
static Crypto.CipherParams getDefaultParams(Array<byte> key)
Spec: RSE1
- Parameters:
key- client-provided key
-
getDefaultParams
static Crypto.CipherParams getDefaultParams(String base64Key)
Spec: RSE1
- Parameters:
base64Key- Base64-encoded key
-
getParams
static Crypto.CipherParams getParams(String algorithm, int keyLength)
-
getParams
static Crypto.CipherParams getParams(String algorithm, Array<byte> key)
-
getParams
static Crypto.CipherParams getParams(String algorithm, Array<byte> key, Array<byte> iv)
-
generateRandomKey
static Array<byte> generateRandomKey(int keyLength)
Generates a random key to be used in the encryption of the channel.If the language cryptographic randomness primitives are blocking or async, a callback is used.The callback returns a generated binary key.
Spec: RSE2
- Parameters:
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.
-
generateRandomKey
static Array<byte> generateRandomKey()
Generates a random key to be used in the encryption of the channel.If the language cryptographic randomness primitives are blocking or async, a callback is used.The callback returns a generated binary key.
Spec: RSE2
-
createChannelEncipher
static Crypto.EncryptingChannelCipher createChannelEncipher(Crypto.CipherParams cipherParams)
Internal; get an encrypting cipher instance based on the given channel options.
-
createChannelDecipher
static Crypto.DecryptingChannelCipher createChannelDecipher(Crypto.CipherParams cipherParams)
Internal; get a decrypting cipher instance based on the given channel options.
-
checkCipherParams
static Crypto.CipherParams checkCipherParams(Object cipherParams)
Internal; if `cipherParams` is null returns default params otherwise check if params valid and returns them
-
getRandomId
static String getRandomId()
-
generateRandomRequestId
static Param generateRandomRequestId()
Returns a "request_id" query param, based on a sequence of 9 random byteswhich have been base64 encoded.Spec: RSC7c
-
-
-
-