I have two AsymmetricAlgorithm objects that contain an RSA Private and RSA Public key. The private key was retrieved out of the Windows-MY keystore and the Public key from a user’s certificate. How can I use these keys along with RSACryptoServiceProvider to encrypt data using the RSA algorithm in C#? In other words, how can I specify that I want to use keys that I already have?
I have two AsymmetricAlgorithm objects that contain an RSA Private and RSA Public key.
Share
The Public Key (arg) should look like this:
<RSAKeyValue>
<Modulus>yNi8BvATA77f+/6cU6z[…]9VULgU=</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
The Private Key (arg) should look like this:
<RSAKeyValue>
<Modulus>yNi8BvATA77f+/6cU6z[…]9VULgU=</Modulus>
<Exponent>AQAB</Exponent>
<P>8ZlZPmko3sam9pvD/l[…]ba0MWLjj9dyUMvmTQ6L8m9IQ==</P>
<Q>1NGHjXyEa9SjUwY[…]v+op2YyyglMeK/Gt5SL0v6xqQZQ==</Q>
<DP>LpjE/aSKnWzzBt1E[…]i5f63Ak9wVG3ZPnwVDwefNkMAQ==</DP>
<DQ>qAgb8AGNiJom[…]8x3qaD3wx+UbnM5v3aE5Q==</DQ>
<InverseQ>fQ4+7r3Nmgvz113L[…]uJqEgCNzw==</InverseQ>
<D>B4n7JNeGHzHe/nqEK[…]GaOBtuz0QTgE=</D>
</RSAKeyValue>