I'm trying to find a solution for clearing sensitive credit card data from memory after communicating it to a payment gateway. Most payment gateways seem to expect the plain text card number as a string in the API. If I use a string in C# I cannot clear the memory as I do not have any control over when the memory is garbage collected. The below dto snippet from an SDK for Cybersource illustrates my problem. Note I'm trying to fulfill PA-DSS version 3.2 requirement 5.1.6.1 Coding techniques include documentation of how PAN and/or SAD are handled in memory. Our auditor is indicating that plain text account numbers cannot be stored in a C# string variable.
We have integrations with other gateways that also have this PAN in string variable issue. How are others dealing with this problem?
namespace CyberSource.Clients.SoapServiceReference
{
//
[DebuggerStepThrough]
[DesignerCategory("code")]
[GeneratedCode("System.Xml", "4.0.30319.34234")]
[XmlType(Namespace = "urn:schemas-cybersource-com:transaction-data-1.109")]
public class Card : INotifyPropertyChanged
{
public Card();
[XmlElement(Order = 6)]
public string cardType { get; set; }
//
[XmlElement(Order = 5)]
public string cvNumber { get; set; }
//
[XmlElement(Order = 4)]
public string cvIndicator { get; set; }
//
[XmlElement(DataType = "integer", Order = 3)]
public string expirationYear { get; set; }
//
[XmlElement(DataType = "integer", Order = 2)]
public string expirationMonth { get; set; }
//
[XmlElement(Order = 1)]
public string accountNumber { get; set; }
//
[XmlElement(Order = 0)]
public string fullName { get; set; }