[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Help changing the KeyExchangeAlgorithm in the .NET RSACryptoServiceProvider class

Posted on 2009-04-23
1
Medium Priority
?
763 Views
Last Modified: 2012-05-06
Hi All,

I'm at a bit of a loss as to how I can change the RSACryptoServiceProvider's KeyExchangeAlgorithm property.

To give you some background, I am building an application that will contain the public key of our server. This application encrypts messages using that public key and then sends them off to our server. The problem is that I am using keyczar (PyCrypto) which is a python RSA library that requires the key exchange/padding to be OAEP. Unfortunately the RSACryptoServiceProvider by default uses some version of the PKCS approach (not sure which one).

Basically this results in the following error message when my server tries to decrypt messages from this application:
"KeyczarError: OAEP Decoding Error - hash is invalid"

If anybody out there is able to shed some light on this problem and help me out I would greatly appreciate it.
// this doesn't work it appears to still use the KeyExchangeAlgorithm specified in the rsa object
byte[] data = Encoding.Unicode.GetBytes("Some Message");
RSAOAEPKeyExchangeFormatter formatter = new RSAOAEPKeyExchangeFormatter(rsa);
byte[] exchange = formatter.CreateKeyExchange(data);
Array.Reverse(exchange);
base64encrypted = Convert.ToBase64String(exchange);

Open in new window

0
Comment
Question by:chris45
1 Comment
 

Accepted Solution

by:
chris45 earned 0 total points
ID: 24230702
I'm closing this question as I have had no responses and have decided to approach the problem a different way. If anyone comes across this question and is having similar issues, I found the Keyczar group to be quite helpful even though I have changed my approach.
http://groups.google.com/group/keyczar-discuss
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
The conference as a whole was very interesting, although if one has to make a choice between this one and some others, you may want to check out the others.  This conference is aimed mainly at government agencies.  So it addresses the various compli…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses
Course of the Month17 days, 18 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question