createLegacyCryptoModule

fun createLegacyCryptoModule(cipherKey: String, randomIv: Boolean = true): CryptoModule

Returns a CryptoModule that encrypts in PubNub's older format.

Important: Use only if you must keep producing payloads readable by very old clients that cannot decode createAesCbcCryptoModule output. For everything else, use createAesCbcCryptoModule — it encrypts with the stronger cipher and still decrypts payloads produced in the older format.

Parameters

cipherKey

Use a randomly generated key instead of a dictionary word to increase security.

randomIv

whether to prepend a random initialization vector to the ciphertext. Keep the default of true. Setting randomIv = false makes every message encrypt with the same hardcoded static IV; reusing one IV with one key in AES-CBC means identical plaintext blocks produce identical ciphertext blocks, leaking plaintext equality across messages. It exists only for backward compatibility with data already encrypted that way.