Implements RSA cipher algorithm.
Inheritance: AsymmetricCipher
Esempio n. 1
0
 public void EncryptTest()
 {
     RsaKey key = null; // TODO: Initialize to an appropriate value
     RsaCipher target = new RsaCipher(key); // TODO: Initialize to an appropriate value
     byte[] data = null; // TODO: Initialize to an appropriate value
     byte[] expected = null; // TODO: Initialize to an appropriate value
     byte[] actual;
     actual = target.Encrypt(data);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 2
0
        public byte[] DecryptSsh1(BigInteger e, BigInteger n, BigInteger encryptedChallenge, byte[] sessionId)
        {
            var decryptKey = GetKey(e, n);

            if (decryptKey == null)
            {
                return null;
            }

            RsaCipher cipher = new RsaCipher((RsaKey)decryptKey.Key.Key);
            byte[] decryptedChallenge = cipher.Decrypt(encryptedChallenge.ToByteArray().Reverse().ToArray());

            var md5 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Md5);
            byte[] response;
            CryptographicBuffer.CopyToByteArray(md5.HashData(CryptographicBuffer.CreateFromByteArray(decryptedChallenge.Concat(sessionId).ToArray())), out response);
            return response;
        }
Esempio n. 3
0
 public void RsaCipherConstructorTest()
 {
     RsaKey key = null; // TODO: Initialize to an appropriate value
     RsaCipher target = new RsaCipher(key);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }