Skip to content

Instantly share code, notes, and snippets.

@AArnott
Created February 7, 2016 01:17
Show Gist options
  • Save AArnott/921fd927fb6582fff387 to your computer and use it in GitHub Desktop.
Save AArnott/921fd927fb6582fff387 to your computer and use it in GitHub Desktop.
#ref System.Numerics.dll
var rsa = new RSACryptoServiceProvider(512);
var parameters = rsa.ExportParameters(true);
var p = new BigInteger(parameters.P.Reverse().ToArray());
var q = new BigInteger(parameters.Q.Reverse().ToArray());
var n = p * q;
Assert.Equal(parameters.Modulus.Reverse().ToArray(), n.ToByteArray());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment