Decrypt() public method

Decrypts the specified data.
Only block type 01 or 02 are supported. Thrown when decrypted block type is not supported.
public Decrypt ( byte data ) : byte[]
data byte The data.
return byte[]
示例#1
0
 public void DecryptTest()
 {
     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.Decrypt(data);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
示例#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;
        }