PrepAway - Latest Free Exam Questions & Answers

You need to write code to encrypt the sensitive data that is in a local variable named myData

You are creating an XML Web service that will be accessed by callers who cannot use SSL encryption because of firewall restrictions. To protect sensitive data, you want to encrypt a portion of the data returned from the service by using objects in the Cryptography namespace.

The service will use a standard encryption routine to encrypt the data before it is sent to the caller. The caller will decrypt the data by using instructions provided by you.

You need to write code to encrypt the sensitive data that is in a local variable named myData. First, you create an instance of a Cryptography Service Provider.

What should you do next?

PrepAway - Latest Free Exam Questions & Answers

A.
Create an Encryptor object that passes in a key and an initialization vector (IV) as parameters.
Call the GetHashCode method of the Encryptor object to generate a new hash code.
Convert the generated hash code to a stream and use the CryptoStream object to write the value of the hash code to an encrypted stream.
Convert the output stream to a string.

B.
Create a UnicodeEncoding object and use it to encode the value of myData into a byte array.
Use the ComputeHash method of the Cryptography Service Provider to create a hash from the encoded byte array.
Convert the output of ComputeHash from a byte array to a string.

C.
Create a UnicodeEncoding object and use it to encode the value of myData into a byte array.
Use the GetHashCode method of the Cryptography Service Provider to create a hash from the encoded byte array.
Convert the output of GetHashCode from a byte array to a string.

D.
Create an Encryptor object that passes in a key and an initialization vector (IV) as parameters.
Create a CryptoStream object that passes in an output stream and the Encryptor object as parameters.
Convert myData to a stream and use the CryptoStream object to write the value of myData to an encrypted
stream.
Convert the output stream to a string.


Leave a Reply