You are developing a method to decrypt data that was encrypted with the Triple DES Algorithm. The method accepts the following parameters:

You are developing a method to decrypt data that was encrypted with the Triple DES Algorithm.
The method accepts the following parameters: The byte array to be decrypted, which is named
cipherMessageThe key, which is named key An initialization vector, which is named iv You need
to decrypt the message by using the TripleDES class and place the result in a string.
Which code segment should you use?

A. TripleDES des = new TripleDESCryptoServiceProvider();des.BlockSize =    
    cipherMessage.Length;ICryptoTransform crypto = des.CreateDecryptor(key,
    iv);MemoryStream cipherStream = new MemoryStream(cipherMessage);CryptoStream
    cryptoStream =
    new CryptoStream(
    cipherStream, crypto, CryptoStreamMode.Read); string message;message = new    
    StreamReader(cryptoStream).ReadToEnd();
B. TripleDES des = new TripleDESCryptoServiceProvider();des.FeedbackSize =    
    cipherMessage.Length;ICryptoTransform crypto = des.CreateDecryptor(key,
    iv);MemoryStream cipherStream = new MemoryStream(cipherMessage);CryptoStream
    cryptoStream =
    new CryptoStream(
    cipherStream, crypto, CryptoStreamMode.Read); string message;message = new    
    StreamReader(cryptoStream).ReadToEnd();
C. TripleDES des = new TripleDESCryptoServiceProvider();ICryptoTransform crypto =    
    des.CreateDecryptor();MemoryStream cipherStream = new    
    MemoryStream(cipherMessage);CryptoStream cryptoStream =
    new CryptoStream(
    cipherStream, crypto, CryptoStreamMode.Read); string message;message = new    
    StreamReader(cryptoStream).ReadToEnd();
D. TripleDES des = new TripleDESCryptoServiceProvider();ICryptoTransform crypto =    
    des.CreateDecryptor(key, iv);MemoryStream cipherStream = new    
    MemoryStream(cipherMessage);CryptoStream cryptoStream =
    new CryptoStream(
    cipherStream, crypto, CryptoStreamMode.Read); string message;message = new    
    StreamReader(cryptoStream).ReadToEnd();



Answer: D

No comments:

Post a Comment