Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Adobe Root format #60

Open
rmhrisk opened this issue Apr 25, 2017 · 6 comments · Fixed by #86
Open

Add support for Adobe Root format #60

rmhrisk opened this issue Apr 25, 2017 · 6 comments · Fixed by #86
Assignees

Comments

@rmhrisk
Copy link
Contributor

rmhrisk commented Apr 25, 2017

The adobe AATL list is downloadable here:
http://trustlist.adobe.com/tl12.acrobatsecuritysettings

This is a PDF that contains an XML file that looks like this:
SecuritySettings.xml.zip

We need to support:

  1. fetching the above url
  2. extracting the xml
  3. parsing the xml and extracting the certs

We have what we need for #1 and #3, @YuryStrozhevsky will give us an SDK that lets us attach and embed attachments in the next month or so.

We could hard code the example securitysettings.xml file and make the rest work and add that in later.

'CCing @fotisl incase he has time and interest :)

@fotisl
Copy link
Contributor

fotisl commented Apr 25, 2017

I have the interest, and I could do it if I find a way to extract the xml :)

@rmhrisk
Copy link
Contributor Author

rmhrisk commented Apr 25, 2017

My hope is that when @YuryStrozhevsky creates his SDK we get something similar to:

Map<String, byte[]> files = new HashMap<String,byte[]>();

PdfReader reader = new PdfReader(pdfPath);
PdfDictionary root = reader.getCatalog();
PdfDictionary names = root.getAsDict(PdfName.NAMES); // may be null
PdfArray embeddedFiles = names.getAsArray(PdfName.EMBEDDEDFILES); //may be null
int len = embeddedFiles.size();
for (int i = 0; i < len; i += 2) {
  PdfName name = embeddedFiles.getAsName(i); // should always be present
  PdfDictionary fileSpec = embeddedFiles.getAsDict(i+1); // ditto
  PRStream stream = (PRStream)fileSpec.getAsStream(PdfName.EF);
  if (stream != null) {
    files.put( PdfName.decodeName(name.toString()), stream.getBytes() );
  }
}

In theory, we can progress with a static file and add extracting real time later, not saying we need to, just saying possible.

@fotisl
Copy link
Contributor

fotisl commented Apr 25, 2017

I will create a parser for the static file, and as soon as the SDK is ready I will incorporate everything to tl-create.

@rmhrisk
Copy link
Contributor Author

rmhrisk commented Apr 27, 2017

@fotisl in the absence @YuryStrozhevsky forthcoming SDK if your interested in looking there is a python tool called pdftk that can unpack PDFs:

pdftk  mydoc.pdf  unpack_files

@rmhrisk
Copy link
Contributor Author

rmhrisk commented May 2, 2017

@fotisl looks like we can do with PDFjs also - https://github.com/mozilla/pdf.js/blob/de7002dc6c7a6fc3d3ee1107a8480953b60b9555/src/core/annotation.js#L1053

If you wanted to do it this way I think @apilguk could help with the PDFjs call.

@WorldThirteen
Copy link
Collaborator

I am reopening this to track the further enhancements:

  • Add Signature verification for AATL source PDF;
  • Determine if it is possible and implement parsing for the certificate operator which is currently always "Unknown".

@WorldThirteen WorldThirteen reopened this Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants