This project is read-only.


problem importing an existing RSAParameters object, with a public key defined?


Forgive me if i'm missing something incredibly obvious, but it seems as though there's an error in the ImportParameters(RSAParameters @params) method.
In short, i'm attempting to encrypt data with a given Modulus/Exponent pair: i.e.,
var raw = new byte[56];
//stuff goes here
byte[] exponent = StringToByteArray(knownExp);
byte[] modulus = StringToByteArray(knownMod);
var rsa = new RSACrypto();
rsa.PaddingProvider=new RSA.PaddingProviders.NoPadding();
var p = new RSAParameters();
p.E = exponent;
p.N = modulus;
var encrypted = rsa.Encrypt(raw);
when i execute this, I get an invalid key exception; specifically, this check:
if (m_RSAParams.E == null || m_RSAParams.N == null || m_RSAParams.E.Length == 0 || m_RSAParams.N.Length == 0)
fails, because m_RSAParams.N is null.
However, the Params object that I passed in has a perfectly valid N. the ImportParameters method, for some reason, skips over importing it from the @params object into the local m_RSAParams instance.
Is this intentional? Am I missing something important?
Closed Dec 15, 2010 at 2:22 PM by DustinHorne


DustinHorne wrote Dec 15, 2010 at 2:40 AM

Hmm...I don't think you're missing anything, it looks like it's completely valid. Let me have a look at the code. Tbh, the ImportParameters was the piece I spent the least amount of time testing, but this should be an easy fix.

wrote Dec 15, 2010 at 3:38 AM

wrote Dec 15, 2010 at 2:22 PM

wrote Oct 31, 2012 at 8:35 PM

wrote Feb 14, 2013 at 2:29 AM

wrote May 16, 2013 at 8:12 AM