Class StandardHandlerUsingAes256

    • Field Detail

      • VALIDATION_SALT_OFFSET

        private static final int VALIDATION_SALT_OFFSET
        See Also:
        Constant Field Values
      • isPdf2

        private boolean isPdf2
      • encryptMetadata

        protected boolean encryptMetadata
    • Constructor Detail

      • StandardHandlerUsingAes256

        public StandardHandlerUsingAes256​(PdfDictionary encryptionDictionary,
                                          byte[] userPassword,
                                          byte[] ownerPassword,
                                          int permissions,
                                          boolean encryptMetadata,
                                          boolean embeddedFilesOnly,
                                          PdfVersion version)
      • StandardHandlerUsingAes256

        public StandardHandlerUsingAes256​(PdfDictionary encryptionDictionary,
                                          byte[] password)
    • Method Detail

      • isEncryptMetadata

        public boolean isEncryptMetadata()
      • setHashKeyForNextObject

        public void setHashKeyForNextObject​(int objNumber,
                                            int objGeneration)
        Description copied from class: SecurityHandler
        Note: For most of the supported security handlers algorithm to calculate encryption key for particular object is the same.
        Overrides:
        setHashKeyForNextObject in class SecurityHandler
        Parameters:
        objNumber - number of particular object for encryption
        objGeneration - generation of particular object for encryption
      • initKeyAndFillDictionary

        private void initKeyAndFillDictionary​(PdfDictionary encryptionDictionary,
                                              byte[] userPassword,
                                              byte[] ownerPassword,
                                              int permissions,
                                              boolean encryptMetadata,
                                              boolean embeddedFilesOnly)
      • setAES256DicEntries

        private void setAES256DicEntries​(PdfDictionary encryptionDictionary,
                                         byte[] oeKey,
                                         byte[] ueKey,
                                         byte[] aes256Perms,
                                         boolean encryptMetadata,
                                         boolean embeddedFilesOnly)
      • initKeyAndReadDictionary

        private void initKeyAndReadDictionary​(PdfDictionary encryptionDictionary,
                                              byte[] password)
      • computeHash

        private byte[] computeHash​(byte[] password,
                                   byte[] salt,
                                   int saltOffset,
                                   int saltLen)
                            throws java.security.NoSuchAlgorithmException
        Throws:
        java.security.NoSuchAlgorithmException
      • computeHash

        private byte[] computeHash​(byte[] password,
                                   byte[] salt,
                                   int saltOffset,
                                   int saltLen,
                                   byte[] userKey)
                            throws java.security.NoSuchAlgorithmException
        Throws:
        java.security.NoSuchAlgorithmException
      • compareArray

        private static boolean compareArray​(byte[] a,
                                            byte[] b,
                                            int len)
      • truncateArray

        private byte[] truncateArray​(byte[] array)