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

  1. Call getDefaultCipherSpec()
  2. Use the returned cipher spec string in encryptDataPacket() and decryptDataPacket()

🧾 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().