Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Encrypt message with cryptography in ax with X509Certificate2

$
0
0
Hi All,

i have a requirement where  body of XML should be encrypt with cryptography with X509Certificates.

the dotnet code is like :-

public string SignData(string xmlBody)
{
string strResult = "";
try
{
X509Certificate2 signerCert = new X509Certificate2(keyPath, keyPass);
byte[] data = System.Text.Encoding.Default.GetBytes(xmlBody);
ContentInfo content = new ContentInfo(data);
SignedCms signed = new SignedCms(content);
CmsSigner signer = new CmsSigner(signerCert);
signer.IncludeOption = X509IncludeOption.EndCertOnly;
signed.ComputeSignature(signer);
byte[] signedBytes = signed.Encode();
string signedBytesBase64 = Convert.ToBase64String(signedBytes);
strResult = signedBytesBase64;
}

Assumption it will provided by client (keyPath, keyPass) Path and password where Cert is uploaded. Kindly let me know if assumption are right.

Could anyone can guide me how to do same in X++. Your help will be much appreciated!

Thanks in advance!

Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>