Thank you for the details.
The Visual Studio created the certificate in such way that the private key was stored in Microsoft key storage with flag limiting the usage of the key for signing operations only. The certificate's private key can not be used for decryption in this case.
You can try it for yourself using system classes (no Rebex code is involved) like this:
var x509 = new X509Certificate2("path.pfx", "password");
var rsa = x509.PrivateKey as RSACryptoServiceProvider;
// Sign and verify is OK
Console.WriteLine("Signing...");
var sig = rsa.SignData(new byte[20], "SHA1");
Console.WriteLine("Validating...");
var valid = rsa.VerifyData(new byte[20], "SHA1", sig);
Console.WriteLine("Valid: {0}", valid);
// Decrypt fails
Console.WriteLine("Encrypting...");
var enc = rsa.Encrypt(new byte[20], false);
Console.WriteLine("Decryptig...");
var msg = rsa.Decrypt(enc, false);
Console.WriteLine("Success: {0}", BitConverter.ToString(msg) == BitConverter.ToString(new byte[20]));
However, you can workaround this with Rebex classes by exporting and importing the private key. It can be done like this:
// load original certificate
var cert = Certificate.LoadPfx("path.pfx", "password");
// export private key to new CSP
var rsa = new RSACryptoServiceProvider();
rsa.ImportParameters(cert.GetRSAParameters(true, false));
// associate new CSP with original certificate
cert.Associate(rsa, false);
// Signing is OK
Console.WriteLine("Signing...");
var sig = cert.SignMessage(new byte[20]);
Console.WriteLine("Validating...");
var valid = cert.VerifyMessage(new byte[20], sig);
Console.WriteLine("Valid: {0}", valid);
// Decryption is OK
Console.WriteLine("Encrypting...");
var enc = cert.Encrypt(new byte[20]);
Console.WriteLine("Decryptig...");
var msg = cert.Decrypt(enc, false);
Console.WriteLine("Success: {0}", BitConverter.ToString(msg) == BitConverter.ToString(new byte[20]));