public void Setup() { _rsa = new SystemAsymmetricEncryptionProvider(); _rsaPublic = new SystemAsymmetricEncryptionProvider(); _rsaPublic.SetKeyPair(_rsa.GetPublicKey()); Assert.IsFalse(_rsa.PublicOnly); Assert.IsTrue(_rsaPublic.PublicOnly); }
public async Task GetPrivateExponentAsyncTest() { var password = "******"; Keypair kp = _rsa.GetPrivateKey(password); await kp.GetPrivateExponentAsync(password); kp = _rsa.GetPublicKey(); Assert.Throws <InvalidOperationException>(() => kp.GetPrivateExponentAsync(password).RunSynchronously()); }
public void GetPublicKeyTest() { Keypair key = _rsa.GetPublicKey(); Keypair key2 = _rsaPublic.GetPublicKey(); Assert.AreEqual(key.Modulus, key2.Modulus); Assert.AreEqual(key.Exponent, key2.Exponent); Assert.IsNull(key.PrivateExponent); Assert.AreEqual(key.PrivateExponent, key2.PrivateExponent); }