PrepAway - Latest Free Exam Questions & Answers

What should you do?

Domain.com has been contracted by the local hospital to create an application that forwards private
patient information to various insurance providers.
The hospital informs you that the amount and frequency of the patient data is high.
You need to ensure that data confidentiality is guaranteed, with as little overhead as possible.
You now need to encrypt the patient information.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Use the following code:
public byte [] EncryptData(byte [] PatientInfo, RSACryptoServiceProvider SecretKey){
CryptoSream cs = new CryptoSream(SecretKey);
cs.Encrypt (PatientInfo, 0, PatientInfo.Length);
byte [] data = cs.ToArray ();
cs.Close ();
return data;
}

B.
Use the following code:
public byte [] EncryptData(byte [] PatientInfo, RSACryptoServiceProvider SecretKey)
MemorySream ms = new MemorySream ();
CryptoSream cs = new CryptoSream(ms,
SecretKey.CreateEncryptor(),CryptoSreamMode.Write);
cs.Write (PatientInfo, 0, PatientInfo.Length);
cs.Close ();
byte [] data = ms.ToArray ();
ms.Close ();
return data;
}

C.
Use the following code:
public byte [] EncryptData(byte [] PatientInfo, DESCryptoServiceProvider SecretKey){
CryptoSream cs = new CryptoSream(SecretKey);
cs.Encrypt(PatientInfo, 0, PatientInfo.Length);
byte [] data = cs.ToArray ();
cs.Close ();
return data;
}

D.
Use the following code:
public byte [] EncryptData (byte [] PatientInfo, DESCryptoServiceProvider SecretKey){
MemorySream ms = new MemorySream ();
CryptoSream cs = new CryptoSream(ms, SecretKey.CreateEncryptor(), CryptoSreamMode.Write);
cs.Write(PatientInfo, 0, PatientInfo.Length);
cs.Close();
byte [] data = ms.ToArray();
ms.Close ();
return data;
}

Explanation:
This code instantiates a CryptoStream object, specifies the ICryptoTransform object to encrypt data,
encrypts the PatientInfo byte array, and returns the encrypted byte array. The DESCryptoServiceProvider class represents a managed cryptographic provider of the DataEncryption Standard (DES) symmetric algorithm.
The DES symmetric algorithm is commonly used for dat confidentiality, and it supports 64- bit keys.
When you instantiate a DESCryptoServiceProvider object, a secret key for encryption and an initialization vector (IV) are created.
Because the same key and IV are needed for encryption and decryption, the CreateEncryptor and CreateDecryptor methods generate the appropriate ICryptoTransform object to alter the data.
Incorrect Answers
A, B: You should not use the code fragments that specify the RSACryptoServiceProvider because this implements an asymmetric algorithm.
C: You should not use the code fragments that invoke the Encrypt method because no such method exists in the CryptoSream class.

2 Comments on “What should you do?


Leave a Reply