Question:
I came up with the following code using the available examples, but the code is not decrypting properly. I'm not sure where I'm setting it up incorrectly and could use some help please:
string pubKey = "nhasasdbasdtene7230asb";
string iv = "a5e8d2e9c1721ae0e84ad660c472c1f3";
Chilkat.Crypt2 crypt = new Chilkat.Crypt2();
bool success = crypt.UnlockComponent("Anything for 30-day trial");
crypt.VerboseLogging = true;
crypt.CryptAlgorithm = "aes";
crypt.CipherMode = "cbc";
crypt.KeyLength = 256;
crypt.PaddingScheme = 0;
crypt.Charset = "utf-8";
crypt.EncodingMode = "hex";
crypt.HashAlgorithm = "sha256";
string derivedKey = crypt.HashStringENC(pubKey);
crypt.SetEncodedIV(iv, "hex");
crypt.SetEncodedKey(derivedKey, "hex");
crypt.Charset = "utf-8";
crypt.EncodingMode = "base64";
// code is a Base64 string
decryptedString = crypt.DecryptStringENC(code);