Skip to content

Instantly share code, notes, and snippets.

@muhaisen
Last active March 13, 2021 11:03
Show Gist options
  • Save muhaisen/f8eb96cdd2d7391a382744f1ee240124 to your computer and use it in GitHub Desktop.
Save muhaisen/f8eb96cdd2d7391a382744f1ee240124 to your computer and use it in GitHub Desktop.
Gets the cipher text from Salesforce encryptWithManagedIV
/// <summary>
/// Retivers the cipher text without the IV
/// </summary>
/// <param name="base64_cipher_text"></param>
/// <returns></returns>
public static byte[] RetrieveCipher(string base64_cipher_text)
{
byte[] cipher_binary = Convert.FromBase64String(base64_cipher_text);
var length = cipher_binary.Length - 16;
byte[] cipher_only = new byte[length];
Array.Copy(cipher_binary, 16, cipher_only, 0, length);
return cipher_only;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment