Class SignaturePolicy


  • public class SignaturePolicy
    extends Object

    A SignaturePolicy represents a policy against which digital signatures are verified.

    In an ideal world this class wouldn't exist. However one of the glaring omissions from the PDF specification is that the list of changes that can be made to a signed PDF without invalidating the signature is undefined. Adobe, as the main PDF vendor, have a policy in Acrobat but this is considered proprietary and has never been documented. It has has changed over the years, although when and how is also undocumented. The fact that it changes at all is also undocumented.

    BFO has attempted to reverse engineer Acrobat's policy over the years, and the constants defined in this class represent our best efforts at various points in history. While in general the current policy is the best one, there will be times when it's necessary to use an older policy. For example, if a file was signed in 2018, it may be preferable to verify that the signature was valid againsat the 2018 policy rather than the current one. Old policies will have bugs, will not be revised, and prior to 2022 will be a less accurate match to Acrobat's behaviour. Caveat validator.

    For now this class is an opaque placeholder for a set of internal rules. There is no ability to createa a custom policy.

    Since:
    2.28
    See Also:
    FormSignature.setSignaturePolicy(org.faceless.pdf2.SignaturePolicy)
    • Field Detail

      • COMPAT_2006

        public static final SignaturePolicy COMPAT_2006
        This policy represents BFO's first effort at a signature policy which was compatible with Acrobat in 2006. It was based on a reverse-engineering of Acrobat 8 and the method described in the "Computation of Object Digests" in PDF Reference 1.7. This policy was used as the default policy between release 2.7.4 and 2.23.4.
      • COMPAT_2019

        public static final SignaturePolicy COMPAT_2019
        This policy represents BFO's best effort at a signature policy which is compatible with Acrobat in 2018. While we're unable to date the changes in Acrobat, they seemed to relate to the introduction of PAdES signatures which were new in Acrobat X (released 2010). This policy was used as the default policy between release 2.23.5 and 2.27
      • COMPAT_2022

        public static final SignaturePolicy COMPAT_2022
        This policy represents BFO's best effort at a signature policy which is compatible with Acrobat in 2022. This policy was introduced in release 2.27.1 and is currently the default policy.
    • Method Detail

      • getDefault

        public static final SignaturePolicy getDefault()
        Return the currently recommended SignaturePolicy, which will be used by default. This is currently COMPAT_2022 but may change in the future