It is very difficult to understand what you're asking. What is the "signature file" you start with? Is it a signed PDF? Have you wrote a program in C# to export, presumably, PDF to XML or did you get the program from someone else?
Apparently this program did not process the PDF file properly. A digital signature in a PDF is a special type of a form field (see PDF specification). If a program correctly traverses the PDF object tree and writes out all objects it finds, it will write out the content of signature fields.
From the PDF point of view a Digital Signature in PDF just a Hex string that represents Hex-encoded PKCS#7 object. The program that parses PDF needs to also properly parse the PKSC#7 objects in the signature form fields if you want to extract the certificate with which the signature was signed and the signer's name in it.
I wrote the C# program. When I obtained the XML output from the PDF, the tabs in the XML were empty even though the
document had them filled. What I am interested in is getting the name of the
person who signed the document and storing that info in some data file. That signature is attached to the Cert file
with the person’s name associated to it. I was hoping to either read the name of the
cert file or the tab would be filled and I could just go to that node and
obtain the name. Any suggestions would
Ah so you wrote the C# program but didn't write the app which made an XML representation of the PDF. There is no standard representation or rule about what should be there. So, the app you are using to export doesn't export signature info. Probably never intended to, just not a suitable tool for your task. It is, perhaps, a little optimistic to hope that exporting to XML will avoid the need to learn how to parse PDF or use a parser library, when you want such detailed specific info.
Could you direct me to a parsing tool to use? Some add-in from Adobe or third party.
thanks for your help
If you Google "pdf to xml converter" you'll get many hits for apps that claim that they do that. I doubt that XML they produce is versatile enough for your purposes. My hunch is that at the most you'll get the Hex string that represents the content of the /V entry in the signature form field dictionary.
An alternate way to find this Hex string is to open PDF in a text editor and search for a dictionary that represents the signature form field and the /V entry in it (this is what I am doing when I need to examine a signature).
If you get this string, then you can do the following:
1. Remove any trailing zeros (padding) from the Hex string, Make sure that the Hex string has even number of characters (the last character may be 0 but not a part of the padding).
2. Convert the Hex string to binary.
3. Use one of the available BER Viewers (Google "ber viewer" to get one) to transform the binary PKCS#7 blob to readable representation.
4. Traverse the BER tree to find the signing certificate and its CN which contains the signer's information.
You may need to learn PDF language, PKCS#7 format in order to do that right. If you need to automate this process you need a good PDF parser first and I am not sure how good PDF-to-XML tools are in this regard. Some BER Viewers show you the BER-decoded text on screen but do not save it to a file, which you need in order to automate the process. There is always issue what do to when you have more than one digital signature in a PDF file.
First a correction. In my previous posts I called the CMS key in PDF /V. That was an error. The key is /Contents.
After thinking more about your problem I found two more solutions that may be easier for you.
2. If you can extract the /Contents Hex string from a PDF and transform it to a binary you can then write a program using packages like Bouncy Castle (bouncycastle.org ) to write a Java or C# program that would get you a signature's signer. The input to your program will be the Hex /Contents string which your program will convert to binary and then pass it as input to Bouncy Castle method that returns the signer.
Neither of the two methods are easy but it is doable.
I do not know. I have not.