I have a large amount of data encrypted with the CAPICOM library through our legacy VB6 applications.
I need to access this data from a .Net 3.5 app but am getting the error: "ASN1 bad tag value met" when I call the Decrypt method. Google has been little help in tracking down decent code samples or explanations as to what this error means.
The following code is almost exactly a replication of what was happening in the VB6 code:
static string DecryptEncryptedText(string encryptedText, string secretKey)
{
var encryptedDataObj = new CAPICOM.EncryptedData();
encryptedDataObj.SetSecret(secretKey, CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD);
encryptedDataObj.Decrypt(encryptedText);
return encryptedDataObj.Content;
}