RFC 3778
The application/pdf Media Type
RFC 3778: The application/pdf Media Type π
Okay bestie, this one is RFC 3778, and it's all about The application/pdf Media Type β¨ It was written by E. Taft, J. Pravetz, S. Zilles, and L. Masinter from Adobe Systems, and it's dated May 2004 πΈ It's in the Network Working Group, and its category is Informational, which means it shares info with the Internet community but doesn't specify an Internet standard of any kind π Per its Abstract, it also updates the media type registration of 'application/pdf' π¦
Status of this Memo π
This memo provides information for the Internet community. It does not specify an Internet standard of any kind. Distribution of this memo is unlimited. π
Copyright Notice Β©οΈ
Copyright (C) The Internet Society (2004). All Rights Reserved. π
Abstract β¨
PDF, the 'Portable Document Format', is a general document representation language that's been used for document exchange on the Internet since 1993 π This doc gives an overview of the PDF format, explains how digital signatures and encryption work inside PDF files, and updates the media type registration of 'application/pdf' π«Ά
Table of Contents ποΈ
1. Introduction. . . . . . . . . . . . . . . . . . . . . . . . . 2
2. History . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3. Fragment Identifiers. . . . . . . . . . . . . . . . . . . . . 3
4. Encryption. . . . . . . . . . . . . . . . . . . . . . . . . . 4
5. Digital Signatures. . . . . . . . . . . . . . . . . . . . . . 5
6. PDF implementations . . . . . . . . . . . . . . . . . . . . . 8
7. Security Considerations . . . . . . . . . . . . . . . . . . . 8
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9
9. References. . . . . . . . . . . . . . . . . . . . . . . . . .
9.1. Normative References. . . . . . . . . . . . . . . . . . 10
9.2. Informative References. . . . . . . . . . . . . . . . . 10
10. Authors' Addresses. . . . . . . . . . . . . . . . . . . . . . 12
11. Full Copyright Statement. . . . . . . . . . . . . . . . . . . 14
1. Introduction π«
So this doc gives you updated info on registering the MIME Media Type "application/pdf" π It really focuses on the features that help with security concerns π It talks about PDF References versions 1 [1], 1.3 [2], 1.4 [3], and 1.5 [4], as updated by errata [5].
PDF is used all over the Internet community. Since it came out in 1993, it's become the go-to format for capturing and exchanging formatted documents electronically π It works across the Web, over e-mail, and literally pretty much every other document exchange method out there π
PDF represents formatted documents π They can be structured or simple, and they can have text, images, graphics, and other multimedia like video and audio π¬ It also supports annotations, metadata, hypertext links, and bookmarks π
PDF supports encryption and digital signatures inside the document π The encryption also gets combined with access control info, which is meant to manage what a recipient is allowed to do with a document π
PDF usage is also specified in other international standards π ISO 15930-1:2001 PDF/X [16] has been adopted as the exchange standard for electronic documents in the Prepress community π¨οΈ PDF/X is a profile of PDF that uses the PDF Reference, Third edition [2], as its source specification.
Another PDF profile, known as PDF/A [17], is being developed to become an international standard for an electronic document file format meant for long-term preservation π Following the PDF/X work, this is joint work between NPES (The Association for Suppliers of Printing, Publishing and Converting Technologies) and AIIM International (the Association for Information and Image Management, International) π€ AIIM is the secretariat for ISO/TC 171 SC2, Document Imaging Applications.
PDF is so widely used that 'application/pdf' shows up in other IETF specs too π¦ RFC 2346 [15] explains how to better structure PDF files for international document exchange where different paper sizes are used. HTTP byte range retrieval is illustrated using application/pdf (RFC 2616 [14], Section 19.2) π¦ And RFC 3297 [13] shows how PDF can be sent to a recipient who identifies their ability to accept PDF using content negotiation π§
2. History π°οΈ
PDF was originally imagined as a way to communicate and view printed info electronically across a wide variety of machine configurations, operating systems, and communication networks, in a reliable manner πΈ
PDF uses the same imaging model as the PostScript page description language to render complex text, images, and graphics in a device- and resolution-independent way πΌοΈ That brings the same look to the screen as well as the printer β¨ To make interactive viewing faster, PDF defines a more structured format than most PostScript language programs use π PDF also has objects, like hypertext links and annotations, that aren't part of the page itself but are super useful for building collections of related documents and for reviewing and commenting on them π¬
The application/pdf media type was first registered in 1993 by Paul Lindner for use by the gopher protocol πΉ The registration was later updated in 1994 by Steve Zilles π
3. Fragment Identifiers π
How fragment identifiers [6] get handled is currently defined in Adobe Technical Note 5428 [7] π This section gives you the summary π«Ά
A fragment identifier is made up of one or more PDF-open parameters in a single URL, separated by the ampersand (&) or pound (#) character π§© Each parameter implies an action to perform, plus the value to use for that action β¨ Actions get processed and executed from left to right, in the order they appear in the fragment identifier string π
The PDF-open parameters let you pick a specific page or named destination to open π Named destinations are kind of like the "anchors" in HTML or the IDs in XML π·οΈ Once you've got your target, you can choose how the page in question gets shown, either by giving the position of a viewing rectangle plus its scale or size coordinates, or by describing a view relative to the viewing window the chosen page is presented in πͺ
Here's the full list of PDF-open parameters and what action each one implies π
nameddest=<name>: Opens to a specified named destination, which includes a view π―page=<pagenum>: Opens the specified (physical) page πzoom=<scale>,<left>,<top>: Sets the<scale>and scrolling factors.<left>and<top>are measured from the top left corner of the page, no matter how big the page is π The<left>and<top>pair is optional, but both must appear if either one is present πview=<keyword>,<position>: Sets the view to show some specified portion of the page or its bounding box. The keywords are defined by Table 8.2 of the PDF Reference, version 1.5 πͺ The<position>value is required for some of the keywords and not allowed for others π§viewrect=<left>,<top>,<wd>,<ht>: Just like the zoom parameter, this sets the scale and scrolling factors, but it uses an explicit width and height instead of a scale percentage πhighlight=<lt>,<rt>,<top>,<btm>: Highlights a rectangle on the chosen page, where<lt>,<rt>,<top>, and<btm>are the coordinates of the sides of the rectangle, measured from the top left corner of the page π
All specified actions run in order, and later actions will override the effects of earlier ones. That's why page actions should appear before zoom actions π§ Commands aren't case sensitive, except for the value of a named destination π
β οΈ Heads up: the value of a named destination is case sensitive, so don't mess with that one π
4. Encryption π
PDF files let you control access using encryption and permission settings ποΈ A document's data decryption keys and permission settings are provided by encryption handlers π§ββοΈ An 'Encryption Dictionary' lives in the document trailer so encryption handlers can store document-specific info π¦ Different encryption handlers can provide different sets of permissions π The PDF encoding rules for password and public key encryption handlers are specified in the PDF Reference π
A person who is able to 'access' a document is said to be able to open and view it π Access is possible when a person can provide the key that decrypts the document π The key is protected and handed out by the encryption handler π‘οΈ Encryption handlers will normally require some sort of authentication before a person can get the document decryption key πͺͺ
Encryption of PDF files is normally applied to all string and stream data in the document, and only to string and stream data π By encrypting just the data portions of the file, random access to the PDF contents is maintained π¦ The data is normally encrypted using the 40 to 128-bit RC4 [8] encryption algorithm π Decryption filters let algorithms other than RC4 be used too π§©
The person who has access to a document is given certain permissions for it π Someone with full permissions, including permission to save a document without encryption, is said to be an 'owner' π Someone with restricted permissions is said to be a 'user' π«Ά Example permissions include the ability to copy text and other content from the PDF file, the ability to fill in form field data, and the ability to print the PDF file π¨οΈ Enforcing permissions is the job of the viewing application π΅οΈββοΈ
Password encryption lets two different passwords be used when providing access to a document π The 'author' password gives access to the document plus full permissions, including permission to save it without encryption β¨ The 'user' password gives access to the document too, but access is restricted by a set of permissions πΈ
Public key encryption of PDF files uses one or more PKCS#7 [9] objects to store info about the recipients who can open a document π¬ Each PKCS#7 object holds a list of recipients, a document decryption key, and permission settings that apply to all recipients listed for that PKCS#7 object π The document decryption key is protected with a triple-DES key, which gets encrypted once with the public key of each listed recipient ποΈπ
5. Digital Signatures ποΈβ¨
okay so bestie, digital signatures are giving "prove it was really you" energy π . They let someone verify who signed a document and whether the contents are still the same. PDF is extra iconic here because it can keep a whole record of what a person actually saw when they signed, so the document can be shown exactly as it looked at that moment π. Multiple people can sign and update the same PDF too, and a later reader can look at the document as it stood at each signature. Main character energy π.
The full spec for PDF digital signatures lives in the PDF Reference [4], section 8.7 and Appendix I π. Here's the tea overview π«Ά.
PDF signature info lives in a 'signature dictionary' data structure ποΈ. To make a signature, you compute a digest of the data in the document. To check it, you recompute the digest and compare it with the one stored in the file. If the digest values don't match, something was modified after signing π.
Every byte of the PDF file gets covered by the signature digest, including the signature dictionary itself, but not the signature value π¦. The byte range is defined and stored as the value of the ByteRange key in the signature dictionary. ByteRange is an array of integer pairs, where each pair is a starting byte offset plus a length in bytes. There are two pairs: one for the bytes before the signature value, and one for the bytes after it πΈ.
PDF public key signature syntax is specified for PKCS#1 [11] and PKCS#7 [9] signatures. In both cases, every byte of the PDF file is signed, except the PKCS#1 or PKCS#7 signature value objects π.
The signature dictionary has some extra attributes too π. The 'SubFilter' attribute describes how the signature value is encoded, and the 'Contents' attribute holds the signature value, which is usually hex (base16) encoded π. There are currently three recommended SubFilter types:
adbe.x509.rsa_sha1 In this case, the Contents key holds a DER-encoded PKCS#1 [11] binary data object. It represents the signature you get by RSA-encrypting the SHA-1 digest of the byte range with the signer's private key. When using PKCS#1, the signer's certificate chain is included with the other signature info in the signed document π.
adbe.pkcs7.sha1 In this case, Contents is a DER-encoded PKCS#7 binary data object containing the signature. The SHA1 digest of the byte range is wrapped in the PKCS#7 signed-data field, with ContentInfo of type "data" π.
adbe.pkcs7.detached In this case, Contents is a DER-encoded PKCS#7 binary data object containing the signature. No data is encapsulated in the PKCS#7 signed-data field π.
If the signature type is 'adbe.x509.rsa_sha1', the signature dictionary includes a key named 'Cert'. It contains at least the signer's X.509 public-key certificate as a binary string. The value can also be an array of strings, where the first entry is the signer's certificate and the following entries are one or more issuer certifications from the signer's trust chain π§.
If the signature type is 'adbe.pkcs7.sha1' or 'adbe.pkcs7.detached', the 'Cert' key is not used, and the certificate MUST be put in the PKCS#7 object stored in the 'Contents' key. The minimum required certificate to include in that PKCS#7 object is the signer's X.509 signing certificate. It MAY also optionally contain one or more issuer certifications from the signer's trust chain β¨.
Multiple signatures work thanks to PDF's incremental save capabilities π¦. When you change a file and apply a new signature, the changes get appended after the last byte of the existing document, and the new signature digest covers all bytes of the new file. So you can edit a document and add new signatures without breaking the earlier ones π. Any change to the document is detected, because every byte of the PDF gets digested π₯.
Rollback is the process of viewing an earlier version of a multiply signed document. You extract the earlier set of bytes from the file and open them in a PDF viewer. That shows the exact state of the document when it was signed, and it's called 'rollback' π·.
PDF syntax allows for 'author' and 'user' signatures. Normally the first signature on a document counts as the author signature, and every other signature counts as a user signature π. Authors can specify which changes are allowed before the author's signature is shown as invalid. Examples include filling in form field data, adding comments, making no changes, or making any changes π. Changes are detected by opening the existing document and the author's version and doing a complete object compare of the two π. But change detection is NOT a substitute for the legal value of document rollback π.
Wait, that last sentence was supposed to read differently in my head π, so here's the faithful version: change detection is not a substitute for the legal value of document rollback π.
6. PDF Implementations π
okay this part is so wholesome π₯Ή. There are a bunch of widely available, independently built, interoperable PDF implementations for all kinds of platforms and systems π. PDF is a publicly available spec, so hundreds of companies and organizations make PDF creation, viewing, and editing tools π οΈ. For examples, check out the descriptions and tool lists from Adobe [20], Apple [21], Ghostscript [22], Planet PDF [18], and PDFzone.com [19] π¦.
7. Security Considerations π¨
bestie, this section is SERIOUS ππ₯, so pay attention. An "application/pdf" resource contains information that the recipient's PDF system has to parse and process π«£. PDF is both a way to represent formatted documents and a container for the resources needed to reproduce or view them. So it's possible that a PDF file has embedded resources that aren't described in the PDF Reference π.
Even though it's not a defined PDF feature, a PDF processor could extract those resources and store them on the recipient's system π. A PDF processor may also accept and run "plug-in" modules available to the recipient, and those can access material in the PDF file or on the recipient's system too π ββοΈ. So care in establishing the source, security, and reliability of plug-ins is RECOMMENDED. Message-sending software SHOULD NOT use arbitrary plug-ins unless their presence at the intended recipients has been agreed on beforehand π«Ά. Message-receiving and -displaying software SHOULD make sure that any non-standard plug-ins are secure and don't present a security threat π.
PDF can contain "scripts" that customize how PDF files are displayed and processed β¨. These scripts are written in a version of JavaScript [10] based on JavaScript version 1.5 of ISO-16262 (formerly known as ECMAScript) π§ͺ. They have access to an API similar to the "plug-in" API, and they're meant to be run by the PDF processor π€. User agents running these scripts or programs MUST be extremely careful to make sure untrusted software runs in a protected environment π¨.
On top of that, JavaScript code might change how a PDF document looks π. Because of that, validating digital signatures SHOULD take this into account π .
In general, any information stored outside the user's direct control can be a source of insecurity, whether obvious or subtle π¬. That includes referenced application software or plug-ins, and embedded files, scripts, or other material not covered in the PDF Reference πΎ. For example, a script can change a document's content before it gets displayed. So the security of any PDF document may depend on the resources it references π« .
As noted above, PDF provides a mechanism for helping ensure a PDF file's integrity: Encryption (Section 4). It also lets you digitally sign (Section 5) a PDF file ποΈ. The signing part lets a recipient decide whether they're willing to trust the file π¦.
If tampering with the PDF file might be a problem, it's RECOMMENDED that you use the encryption and digital signature features to protect and authenticate the PDF π.
Finally, PDF processors may have mechanisms that track where scripts or plug-ins came from, and they'll only run the ones that meet the processor's trustworthiness requirements for their sources πΈ.
8. IANA Considerations π
This document updates the registration of 'application/pdf', which is a media type registration defined in Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures [12] π:
MIME media type name: application
MIME subtype name: pdf
Required parameters: none
Optional parameter: none
Encoding considerations:
PDF files frequently contain binary data, and thus must be encoded
in non-binary contexts.
Security considerations:
See Section 7 of this document.
Interoperability considerations:
See Section 6 of this document.
Published specification:
Adobe Systems Incorporated, "PDF Reference, Fourth Edition",
Version 1.5, August 2003, <http://partners.adobe.com/asn/tech/pdf/
specifications.jsp>, as amended by errata <http://
partners.adobe.com/asn/acrobat/sdk/public/docs/errata.txt>.
Applications which use this media type:
See Section 6 of this document.
Additional information:
Magic number(s):
All PDF files start with the characters '%PDF-' using the PDF
version number, e.g., '%PDF-1.4'. These characters are in US-
ASCII encoding.
File extension(s): .pdf
Macintosh File Type Code(s): "PDF "
For further information:
Adobe Developer Support <dev-support@adobe.com>
Adobe Systems Incorporated
345 Park Ave
San Jose, CA 95110
http://www.adobe.com/support/main.html
Intended usage: COMMON
Author/Change controller:
Adobe Developer Support <dev-support@adobe.com>
Adobe Systems Incorporated
345 Park Ave
San Jose, CA 95110
http://www.adobe.com/support/main.html
9. References π
9.1. Normative References β¨
okay bestie, these are the references you're required to have read, because the spec leans on them hard π I've kept every title, version, ISBN, date and URI exactly as written, since one wrong digit could send you chasing the wrong book π
[1] Adobe Systems Incorporated, "Portable Document Format Reference Manual", Version 1.0, ISBN: 0-201-62628-4, Addison-Wesley, New York NY, 1993.
[2] Adobe Systems Incorporated, "PDF Reference, Second Edition", Version 1.3, ISBN: 0-201-61588-6, Addison-Wesley, New York NY, 2000.
[3] Adobe Systems Incorporated, "PDF Reference, Third Edition", Version 1.4, ISBN: 0-201-75839-3, Addison-Wesley, New York NY, November 2001.
[4] Adobe Systems Incorporated, "PDF Reference, Fourth Edition", Version 1.5, August 2003, <http://partners.adobe.com/asn/tech/pdf/specifications.jsp>.
[5] Adobe Systems Incorporated, "Errata for PDF Reference, Fourth Edition", December 2003, <http://partners.adobe.com/asn/acrobat/sdk/public/docs/errata.txt>. π©Ή the errata are a must-read, trust me
[6] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform Resource Identifiers (URI): Generic Syntax", RFC 2396, August 1998. π
[7] Adobe Systems Incorporated, "PDF Open Parameters", Technical Note 5428, May 2003, <http://partners.adobe.com/asn/acrobat/sdk/public/docs/PDFOpenParams.pdf>.
[8] Rivest, R., "RC4 - an unpublished, trade secret encryption algorithm", November 1993, <http://www.rsasecurity.com/rsalabs/faq/3-6-3.html>. π΅οΈββοΈ a trade secret that's now a whole legend, iconic
[9] Kaliski, B., "PKCS #7: Cryptographic Message Syntax Version 1.5", RFC 2315, March 1998. π
[10] Adobe Systems Incorporated, "Acrobat JavaScript Scripting Reference", Technical Note 5431, September 2003, <http://partners.adobe.com/asn/acrobat/sdk/public/docs/AcroJS.pdf>.
[11] Jonsson, J. and B. Kaliski, "Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography Specifications Version 2.1", RFC 3447, February 2003. π
9.2. Informative References πΈ
these ones are the extra-credit reading, the "oh you want to go deeper?" list π¦ they're not strictly required, but they're so worth it
[12] Freed, N., Klensin, J. and J. Postel, "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures", BCP 13, RFC 2048, November 1996.
[13] Klyne, G., Iwazaki, R. and D. Crocker, "Content Negotiation for Messaging Services based on Email", RFC 3297, July 2002. π¬
[14] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P. and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. π
[15] Palme, J., "Making Postscript and PDF International", RFC 2346, May 1998. π§
[16] International Standards Organization, "Graphic technology -- Prepress digital data exchange -- Use of PDF -- Part 1: Complete exchange using CMYK data (PDF/X-1 and PDF/X-1a)", ISO 15930-1:2001, November 2002. π¨
[17] Association for Information and Image Management, "PDF-Archive Committee home page", December 2003, <http://www.aiim.org/pdf_a/>. ποΈ
[18] Planet PDF, "Planet PDF Tools List", December 2003, <http://www.planetpdf.com/>. π§°
[19] InternetBiz.net, "PDF software from the PDF zone toolbox", December 2003, <http://www.pdfzone.com/toolbox/>.
[20] Adobe Systems Incorporated, "Adobe products page", December 2003, <http://www.adobe.com/products/>.
[21] Apple Computer, Inc., "Apple Mac OS X Features - Preview", December 2003, <http://www.apple.com/macosx/features/preview/>. π
[22] Artifex Software, Inc, "Ghostscript", December 2003, <http://www.ghostscript.com/>. π»
10. Authors' Addresses π
meet the squad who wrote this one! all four of them worked at Adobe back then, so it's basically a PDF girl group π
Edward A. Taft
Adobe Systems
345 Park Ave
San Jose, CA 95110
US
EMail: taft@adobe.com
James D. Pravetz
Adobe Systems
345 Park Ave
San Jose, CA 95110
US
EMail: jpravetz@adobe.com
Stephen Zilles
Adobe Systems
345 Park Ave
San Jose, CA 95110
US
Phone: +1 408 536 7692
EMail: szilles@adobe.com
Larry Masinter
Adobe Systems
345 Park Ave
San Jose, CA 95110
US
Phone: +1 408 536 3024
EMail: LMM@acm.org
URI: http://larry.masinter.net
11. Full Copyright Statement βοΈ
the legal bit, bestie, but it matters, so here it is in full π«Ά
Copyright (C) The Internet Society (2004). This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.
This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property π
the IETF isn't saying whether any patents or other rights cover this tech, and it hasn't gone hunting for them either. if you want the rules on rights in RFC documents, look in BCP 78 and BCP 79 π
copies of IPR disclosures sent to the IETF Secretariat, plus any promises of licenses, or the results of any attempt to get a general license or permission for implementers or users, can be found in the IETF on-line IPR repository at http://www.ietf.org/ipr.
the IETF invites anyone who's interested to flag any copyrights, patents or patent applications, or other proprietary rights that might cover technology needed to implement this standard. send that info to the IETF at ietf-ipr@ietf.org π¨
Acknowledgement π
the RFC Editor function is currently funded by the Internet Society. thank you to them for keeping the lights on π
π¦ where this page comes from
- ietf: rfc3778 2004-05
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms