I'm trying to understand why Encrypt stopped working. It seems it might be environmental because I know it was working, but then some time passed and when I want back to resume work on it, it no longer worked. The code hasn't changed and I don't remember any changes to the environment so I'm stumped.
The code is below It finds the cert fine, but when it calls Encrypt, it returns zero bytes when a byte array (b) is passed in. No exceptions are thrown. I'm using C#.
Cert c = store.FindCertBySubjectCN(subjectCN);
if (c != null)
{
crypt.SetEncryptCertificate(c);
byte[] encryptedBytes = crypt.Encrypt(b); // returns 0 bytes
}