Answer the question
In order to leave comments, you need to log in
How to translate from C# to PHP the byte array signing function?
Hello
There is a ready method in C# for signing an array of bytes using a certificate
public static string SignData(byte[] bytes, X509Certificate2 certificate)
{
var contentInfo = new ContentInfo(bytes);
var signedCms = new SignedCms(contentInfo, true);
var cmsSigner = new CmsSigner(certificate);
signedCms.ComputeSignature(cmsSigner);
var signature = signedCms.Encode();
return Convert.ToBase64String(signature);
}
Answer the question
In order to leave comments, you need to log in
1) This is a task, not a question.
2) C# code won't help you from the word "no way". In PHP, you won't find a direct match for every line. We need to look for the implementation in the context of PHP
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question