私は暗号化にかなり慣れていません。これまでのところ、エンベロープ CMS ファイルの生成に成功しています。しかし、その後、ASN.1 DER 形式を使用して CMS 署名および暗号化されたデータ ファイルをエンコードする必要がありますが、方法がわかりません。何か提案をください。
以下に、より多くの光を得るためにコードを貼り付けます。
var content = File.ReadAllBytes(@"E:\Miscellaneous\Pacs.zip");
var contentInfo1 = new ContentInfo(content);
var signedCms = new SignedCms(contentInfo1);
var cmsSigner = new CmsSigner(GetSignerCert()) { IncludeOption = X509IncludeOption.None };
signedCms.ComputeSignature(cmsSigner);
var contentInfo = new ContentInfo(signedCms.Encode());
// RSA_DES_EDE3_CBC.
var envelopedCms = new EnvelopedCms(contentInfo);
var recip1 = new CmsRecipient(
SubjectIdentifierType.IssuerAndSerialNumber,
GetRecipientCert());
envelopedCms.Encrypt(recip1);
File.WriteAllBytes(@"E:\signedfile", envelopedCms.Encode());
// need code to encode signedfile using ASN.1 DER