private static BigInteger SignPrimative(BigInteger m, RSAPrivateKey key) { return DecryptPrimative(m, key); }
public void Init(ICipherParameters parameters) { var pubKeyParams = parameters as PublicKeyParameter; if (pubKeyParams != null) { SecurityAssert.SAssert(pubKeyParams.Key is RSAPublicKey); pub = (RSAPublicKey)pubKeyParams.Key; return; } var privKeyParams = parameters as PrivateKeyParameter; if (privKeyParams != null) { SecurityAssert.SAssert(privKeyParams.Key is RSAPrivateKey); priv = (RSAPrivateKey)privKeyParams.Key; pub = (RSAPublicKey)priv.PublicKey; return; } throw new InvalidCastException(); }
private static BigInteger DecryptPrimative(BigInteger c, RSAPrivateKey key) { SecurityAssert.SAssert(c >= 0 && c < key.Modulus); return BigInteger.ModPow(c, key.PrivateExponent, key.Modulus); }