Question: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 cipherMessage
The 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 Dim objDES As New TripleDESCryptoServiceProvider
Dim objCrypto As ICryptoTransform = _
objDES.CreateDecryptor()
Dim cipherStream As New MemoryStream(cipherMessage)
Dim cryptoStream As New CryptoStream( _
cipherStream, objCrypto, CryptoStreamMode.Read)
Dim message As String
message = New StreamReader(cryptoStream).ReadToEnd 

B Dim objDES As New TripleDESCryptoServiceProvider
objDES.FeedbackSize = cipherMessage.Length
Dim objCrypto As ICryptoTransform = _
objDES.CreateDecryptor(key, iv)
Dim cipherStream As New MemoryStream(cipherMessage)
Dim cryptoStream As New CryptoStream( _
cipherStream, objCrypto, CryptoStreamMode.Read)
Dim message As String
message = New StreamReader(cryptoStream).ReadToEnd 

C Dim objDES As New TripleDESCryptoServiceProvider
Dim objCrypto As ICryptoTransform = _
"A Composite Solution With Just One Click" - Certification Guaranteed 187 Microsoft 70-536 Exam objDES.CreateDecryptor(key, iv)
Dim cipherStream As New MemoryStream(cipherMessage)
Dim cryptoStream As New CryptoStream( _
cipherStream, objCrypto, CryptoStreamMode.Read)
Dim message As String
message = New StreamReader(cryptoStream).ReadToEnd 

D Dim objDES As New TripleDESCryptoServiceProvider
objDES.BlockSize = cipherMessage.Length
Dim objCrypto As ICryptoTransform = _
objDES.CreateDecryptor(key, iv)
Dim cipherStream As New MemoryStream(cipherMessage)
Dim cryptoStream As New CryptoStream( _
cipherStream, objCrypto, CryptoStreamMode.Read)
Dim message As String
message = New StreamReader(cryptoStream).ReadToEnd 

+ Answer
+ Report
Total Preview: 797

Copyright © 2024. Powered by Intellect Software Ltd