Encryption
π§©π Encryption/Decryption Implementationβ
Encryption/Decryption implementation for reference (C# code):
string strFormattedString = string.Empty;
RijndaelManaged objAESEncDec = new RijndaelManaged();
objAESEncDec.Mode = CipherMode.CBC;
objAESEncDec.Padding = PaddingMode.PKCS7;
objAESEncDec.KeySize = 0x80;
objAESEncDec.BlockSize = 0x80;
byte[] bPwdBytes = Encoding.UTF8.GetBytes(strKey);
byte[] bKeyBytes = new byte[0x10];
int iPwdLen = bPwdBytes.Length;
if (iPwdLen > bKeyBytes.Length)
iPwdLen = bKeyBytes.Length;
Array.Copy(bPwdBytes, bKeyBytes, iPwdLen);
objAESEncDec.Key = bKeyBytes;
objAESEncDec.IV = bKeyBytes;
π For Encryptionβ
ICryptoTransform objTransform = objAESEncDec.CreateEncryptor(); byte[] bPlainText = Encoding.UTF8.GetBytes(strData); strFormattedString = Convert.ToBase64String(objTransform.TransformFinalBlock(bPlainText, 0, bPlainText.Length));
π For Decryptionβ
byte[] bEncryptedData = Convert.FromBase64String(strData); byte[] bPlainText = objAESEncDec.CreateDecryptor().TransformFinalBlock(bEncryptedData, 0, bEncryptedData.Length); strFormattedString = Encoding.UTF8.GetString(bPlainText);
ποΈ Note :
In the above implementation logic, βstrDataβ is the string value that needs to encrypt/decrypt. βstrKeyβ will be the Encryption key configured by Broker for each of the SSO links in WebAdmin.