Skip to content

Commit efc9f9b

Browse files
authored
Merge pull request #76 from CyberSource/new_branch_scmp
Modified code
2 parents a1f706e + d934d6b commit efc9f9b

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

CyberSource/Client/XmlClient.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,7 @@ private static void SignDocument(X509Certificate2 cert, XmlDocument doc)
311311
SignedXml signedXML = new SignedXml(doc);
312312
signedXML.AddReference(reference);
313313

314-
var exportedKeyMaterial = cert.PrivateKey.ToXmlString(true);
315-
var key = new RSACryptoServiceProvider(new CspParameters(24));
316-
key.PersistKeyInCsp = false;
317-
key.FromXmlString(exportedKeyMaterial);
318-
RSACryptoServiceProvider rsaKey = key;
319-
signedXML.SigningKey = rsaKey;
314+
signedXML.SigningKey = cert.GetRSAPrivateKey();
320315
signedXML.SignedInfo.CanonicalizationMethod = SignedXml.XmlDsigExcC14NTransformUrl;
321316

322317
XmlDsigExcC14NTransform canMethod = (XmlDsigExcC14NTransform)signedXML.SignedInfo.CanonicalizationMethodObject;

CyberSourceSamples/src/scmp/app.config

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<configuration>
22
<appSettings>
33

4-
<add key="cybs.merchantID" value="" />
5-
<add key="cybs.keysDirectory" value="" />
6-
<add key="cybs.keysAlias" value="" />
7-
<add key="cybs.Password" value="" />
4+
<add key="cybs.merchantID" value="" />
5+
<add key="cybs.keysDirectory" value="" />
6+
<add key="cybs.keysAlias" value="" />
7+
<add key="cybs.Password" value="" />
88

99
<!--the following flags can be used to control the endpoint to which requests will be sent.
1010
Set sendToProduction=true to send requests to Cybersource production environment.

0 commit comments

Comments
 (0)