login about faq

I'm upgrading from an older version of Chilkat Crypt library for .NET to the 4.5 library (32-bit). The api seems to have significantly changed and can't find an example that loads from the certificate store. My old code looked like this:

Crypt crypt = new Crypt();
crypt.UnlockComponent("whatever");

crypt.SetAlgorithmRSA();

CreateCS ccs = new CreateCS();
CertStore store = ccs.OpenLocalSystemStore();

Cert c = store.FindCertBySubjectCN(subjectCN);
if (c != null)
{
    crypt.SetEncryptCertificate(c);
}
else
{
    throw new ApplicationException("Cannot find certificate " + subjectCN);
}

byte[] encryptedBytes = crypt.Encrypt(b);
return crypt.EncodeBase64(encryptedBytes);

The best example I could find was here: https://www.example-code.com/csharp/rsa_encryptCreditCard.asp but it doesn't map easily to what I have.

I think I figured out how to 64 bit encode, but how do I set the algorithm to RSA and set the certificate?

Thanks.

asked Jun 22 at 13:48

codersteve's gravatar image

codersteve
1

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×64

Asked: Jun 22 at 13:48

Seen: 186 times

Last updated: Jun 22 at 13:48

powered by OSQA