There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
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;
//stuff goes here
byte exponent = StringToByteArray(knownExp);
byte modulus = StringToByteArray(knownMod);
var rsa = new RSACrypto();
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?