pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bal (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PDFBOX-4312) byte array format to pass to sign method
Date Mon, 17 Sep 2018 05:41:00 GMT

    [ https://issues.apache.org/jira/browse/PDFBOX-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16617107#comment-16617107
] 

bal commented on PDFBOX-4312:
-----------------------------

I have generated byte  array by deserializing the xml to object. The size of byte array for
docsignature element i am getting is 2911 belowis the code for that.I am storing this byte
array to docSigDict dictionary and retriving this value to assign to byte array in sign method.
yet my signature in not inserting in the blankbox please guide me it's very important to me
to solve this issue .

 

public class XmlObjectConverter
 {
 //fields
 private XmlSerializer Serializer;
 private XmlSerializer Deserializer;
 string XmlString = "";


 //methods
 public XmlSerializer getSerializer()
 {
 return Serializer;
 }

public void setSerializer(XmlSerializer serializer)
 {
 this.Serializer = serializer;
 }

public XmlSerializer getDeserializer()
 {

return Deserializer;

}

public void setDeserializer(XmlSerializer deserializer)
 {
 this.Deserializer = deserializer;
 }

public String ObjectToXml<EsignResponse>(EsignResponse obj)
 {
 XmlSerializer serializer = new XmlSerializer(typeof(EsignResponse));

using (System.IO.StringWriter textWriter = new System.IO.StringWriter())
 {
 serializer.Serialize(textWriter, obj);
 return XmlString.ToString();
 }

}

public object XmlToObject(object obj, string XmlString)
 {
 XmlDocument xDoc = new XmlDocument();

xDoc.LoadXml(XmlString);

XmlSerializer serializer = new XmlSerializer(typeof(EsignResponse), new XmlRootAttribute("EsignResp"));
 MemoryStream stream = new MemoryStream();
 System.IO.StringWriter sw = new System.IO.StringWriter();
 sw.Write(XmlString);
 byte[] bytes = Encoding.UTF8.GetBytes(XmlString);
 //MemoryStream xmlStream = new MemoryStream(bytes);
 MemoryStream output = new MemoryStream(bytes);
 obj = serializer.Deserialize(output);

return obj;
 }

 

 

> byte array format to pass to sign method
> ----------------------------------------
>
>                 Key: PDFBOX-4312
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4312
>             Project: PDFBox
>          Issue Type: Wish
>          Components: .NET, PDModel, Signing
>    Affects Versions: 1.8.9
>            Reporter: bal
>            Priority: Major
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 signature
to byte array using Convert.FromBase64String method in .net . I am passing this byte array
to sign method in signature interface which gets called after calling saveincremental. My
byte array is inserting proper but the name of which signature is not shown when i open pdf.
May be my byte conversion may not proper or something else i am doing wrong. please let me
know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Mime
View raw message