如何使用iTextSharp将数字签名添加到memorystreram

时间:2015-07-16 08:04:24

标签: itextsharp itext digital-signature

是否可以使用iTextSharp library,处理数字签名并将其与内存流相关联 稍后返回此内存流,以便在从该内存流创建PDF文件时创建一个经过数字签名的文件

public MemoryStream Sign(MemoryStream ms)
{
    PdfReader reader = new PdfReader(ms);
    //I also try 
    //PdfReader reader = new PdfReader(ms.ToArray());
    PdfStamper st = new PdfStamper(reader, ms, '\0', true);
    PdfSignatureAppearance sap = st.SignatureAppearance;
    sap.SetCrypto(this.myCert.Akp, this.myCert.Chain, null, PdfSignatureAppearance.WINCER_SIGNED);
    sap.SetVisibleSignature(new iTextSharp.text.Rectangle(100, 100, 250, 150), 1, null);
    return ms;
}

它提供错误的PDF标题签名未找到。

0 个答案:

没有答案