getDefaultCipherSpec
🔐 REL-ID SDK API Documentation: getDefaultCipherSpec
📘 Overview
The getDefaultCipherSpec
API returns the default cipher specification configured for the current REL-ID SDK environment. This cipher specification includes algorithm, key size, mode, padding, and hash algorithm used for encrypting and decrypting data securely.
This is a convenience method designed to reduce hardcoding of cipher specs and ensure consistency across encryption and decryption calls like encryptDataPacket
and decryptDataPacket
.
🎯 Purpose
Use this API to retrieve the cipher specification string to be passed to other cryptographic APIs.
🔁 API Flow
- Call
getDefaultCipherSpec()
- Use the returned cipher spec string in
encryptDataPacket()
anddecryptDataPacket()
🧾 Response
Returns a string in the format:
<EncryptionAlgo>/<KeySize>/<Mode>/<Padding>:<HashAlgorithm>
🔧 Example:
AES/256/CFB/NoPadding:SHA-256
This means:
- Algorithm: AES
- Key size: 256 bits
- Mode: CFB
- Padding: NoPadding
- Hash Algorithm: SHA-256
💻 Code Snippets
React Native
RdnaClient.getDefaultCipherSpec((response) => {
const cipherSpec = response.response;
});
Flutter
final cipherSpec = await rdnaClient.getDefaultCipherSpec();
Cordova
com.uniken.rdnaplugin.RdnaClient.getDefaultCipherSpec(successCallback, errorCallback);
Native iOS
NSString* cipherSpec = [rdnaClient getDefaultCipherSpec];
Native Android
String cipherSpec = rdnaClient.getDefaultCipherSpec();
🧠 Developer Notes
- Always retrieve and reuse this cipherSpec rather than hardcoding one.
- Recommended to cache it for the session lifetime.
- Can be paired with
getDefaultCipherSalt()
.
Updated 2 months ago