Assinatura diferente de S / MIME entre OpenSSL e C #

Estou tentando usar um código OpenSSL no meu programa .Net. Aqui está o código:

openssl pkcs12 -in "My PassKit Cert.p12" -clcerts -nokeys -out certificate.pem
openssl pkcs12 -in "My PassKit Cert.p12" -nocerts -out key.pem
smime -binary -sign -signer certificate.pem -inkey key.pem -in manifest.json -out signature -outform DER

Eu tentei usar o .Net OpenSSL, mas eu absolutamente não tenho idéia de como usá-lo, e não consegui encontrar uma boa documentação para ele. Eu decidi usar o .net para executar o mesmo processo de sinal, aqui está o código:

var dataToSign = System.IO.File.ReadAllBytes(filePathToSign);
ContentInfo contentInfo = new ContentInfo(dataToSign);

X509Certificate2 signerCert = new X509Certificate2(System.IO.File.ReadAllBytes(signerPfxCertPath), signerPfxCertPassword);

var signedCms = new SignedCms(contentInfo, true);
var signer = new CmsSigner(SubjectIdentifierType.IssuerAndSerialNumber, signerCert);

signer.IncludeOption = X509IncludeOption.EndCertOnly;
signedCms.ComputeSignature(signer);

var myCmsMessage = signedCms.Encode();

var buf = Encoding.Convert(Encoding.UTF7, Encoding.UTF8, myCmsMessage);

return Encoding.UTF8.GetString(buf, 0, buf.Length);

Mas os resultados entre C # e OpenSSL não são os mesmos. Alguém por favor pode me ajudar?

Desde já, obrigado!

questionAnswers(1)

yourAnswerToTheQuestion