8. Encrypting & Decrypting Metadata with SAS-DROSby: saaiqSASLast Updated: 26/2/2025
The ROSET API offers a variant of the SAS-DROS (Saaiq Adbulla Saeed's - Direct Random Object Substitution) Cipher, which utilizes characters as 'objects' in the encryption process. This cipher relies solely on the Dynamic Key for encryption, providing a simpler, less secure method of data protection.
This section, will cover the methods used for encrypting and decrypting Strings, (typically used for non-sensitive metadata), using the SAS-DROS cipher. Additionally, we will explore other available methods to enhance the security of metadata.
A usage sample of the ROSET Java API is available on GitHub. You can view it
here (ROSET Java API Usage Sample).
The SAS-ROSET API provides three methods to help create secure metadata for encrypted data:
> String drosEncrypt(int DynUid, String data)
> String drosDecrypt(int DynUid, String data)
> String getCharFromDynamicKey(int DynUid, int divideBy, int add)
The drosEncrypt(int DynUid, String data) method returns an encrypted String. Note that the String data provided should only contain ASCII characters, as DROS encryption only supports them.
The drosDecrypt(int DynUid, String data) method returns the decrypted String. Be sure to pass the correct Dynamic Key reference ID that was used to encrypt the data.
The getCharFromDynamicKey(int DynUid, int divideBy, int add) method returns a character from the Dynamic Key as a String at a specific position. The position is calculated using the divideBy and add values. First, the total key length is divided by the divideBy value, and then the add value is added to the result. The final result determines the position from which the character is retrieved. This process ensures that the character chosen will vary depending on the key length, providing additional security.
The returned character can be used as metadata, booleans, or for identifying the encryption algorithm. This is possible because for the same Dynamic Key, along with the same divideBy and add values, the same character will always be returned.