Skip to content

Commit bab074f

Browse files
committed
Change for password field
1 parent d699b23 commit bab074f

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

CyberSource/Client/Service References/SoapServiceReference/Reference.cs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31953,7 +31953,7 @@ public partial class BillTo : object, System.ComponentModel.INotifyPropertyChang
3195331953

3195431954
private string phoneNumberField;
3195531955

31956-
private System.Security.SecureString emailField;
31956+
private string emailField;
3195731957

3195831958
private string ipAddressField;
3195931959

@@ -32281,13 +32281,12 @@ public string phoneNumber {
3228132281

3228232282
/// <remarks/>
3228332283
[System.Xml.Serialization.XmlElementAttribute(Order=20)]
32284-
public System.Security.SecureString email {
32284+
public string email {
3228532285
get {
3228632286
return this.emailField;
3228732287
}
3228832288
set {
3228932289
this.emailField = value;
32290-
this.emailField.MakeReadOnly();
3229132290
this.RaisePropertyChanged("email");
3229232291
}
3229332292
}
@@ -48226,19 +48225,13 @@ public string loginID {
4822648225

4822748226
/// <remarks/>
4822848227
[System.Xml.Serialization.XmlElementAttribute(Order=9)]
48229-
public System.Security.SecureString password {
48228+
public string password {
4823048229
get {
48231-
return this.passwordField;
48230+
return ConvertToUnsecureString(this.passwordField);
4823248231
}
4823348232
set {
48234-
if (value == null)
48235-
{
48236-
this.passwordField = null;
48237-
}
48238-
else {
48239-
this.passwordField = value;
48240-
this.passwordField.MakeReadOnly();
48241-
}
48233+
this.passwordField = new System.Net.NetworkCredential(string.Empty, value).SecurePassword;
48234+
this.passwordField.MakeReadOnly();
4824248235
this.RaisePropertyChanged("password");
4824348236
}
4824448237
}
@@ -49019,6 +49012,25 @@ protected void RaisePropertyChanged(string propertyName) {
4901949012
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
4902049013
}
4902149014
}
49015+
49016+
public static string ConvertToUnsecureString(System.Security.SecureString secureString)
49017+
{
49018+
if (secureString == null)
49019+
{
49020+
return string.Empty;
49021+
}
49022+
49023+
System.IntPtr unmanagedString = System.IntPtr.Zero;
49024+
try
49025+
{
49026+
unmanagedString = System.Runtime.InteropServices.Marshal.SecureStringToGlobalAllocUnicode(secureString);
49027+
return System.Runtime.InteropServices.Marshal.PtrToStringUni(unmanagedString);
49028+
}
49029+
finally
49030+
{
49031+
System.Runtime.InteropServices.Marshal.ZeroFreeGlobalAllocUnicode(unmanagedString);
49032+
}
49033+
}
4902249034
}
4902349035

4902449036
/// <remarks/>

CyberSourceSamples/src/soap/SoapSample.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ public RequestMessage authRequest()
387387
billTo.state = "CA";
388388
billTo.postalCode = "94043";
389389
billTo.country = "US";
390-
billTo.email = convertToSecureString("[email protected]");
390+
billTo.email = "[email protected]";
391391
billTo.ipAddress = "10.7.111.111";
392392
request.billTo = billTo;
393393

@@ -612,7 +612,7 @@ public RequestMessage paymentNetworkTokenizationRequest()
612612
billTo.state = "CA";
613613
billTo.postalCode = "94043";
614614
billTo.country = "US";
615-
billTo.email = convertToSecureString("[email protected]");
615+
billTo.email = "[email protected]";
616616
billTo.ipAddress = "10.7.111.111";
617617
request.billTo = billTo;
618618

@@ -673,7 +673,7 @@ public RequestMessage refundRequest()
673673
billTo.state = "CA";
674674
billTo.postalCode = "94043";
675675
billTo.country = "US";
676-
billTo.email = convertToSecureString("[email protected]");
676+
billTo.email = "[email protected]";
677677
billTo.ipAddress = "10.7.111.111";
678678
request.billTo = billTo;
679679

@@ -749,7 +749,7 @@ public RequestMessage androidPayAuthRequest()
749749
billTo.state = "CA";
750750
billTo.postalCode = "94043";
751751
billTo.country = "US";
752-
billTo.email = convertToSecureString("[email protected]");
752+
billTo.email = "[email protected]";
753753
billTo.ipAddress = "10.7.111.111";
754754
request.billTo = billTo;
755755

@@ -817,7 +817,7 @@ public RequestMessage applePayAuthRequest()
817817
billTo.state = "CA";
818818
billTo.postalCode = "94043";
819819
billTo.country = "US";
820-
billTo.email = convertToSecureString("[email protected]");
820+
billTo.email = "[email protected]";
821821
billTo.ipAddress = "10.7.111.111";
822822
request.billTo = billTo;
823823

@@ -883,7 +883,7 @@ public RequestMessage saleRequest()
883883
billTo.state = "CA";
884884
billTo.postalCode = "94043";
885885
billTo.country = "US";
886-
billTo.email = convertToSecureString("[email protected]");
886+
billTo.email = "[email protected]";
887887
billTo.ipAddress = "10.7.111.111";
888888
request.billTo = billTo;
889889

0 commit comments

Comments
 (0)