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!
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!