Package org.apache.pdfbox.pdmodel.encryption

Examples of org.apache.pdfbox.pdmodel.encryption.DecryptionMaterial


            {
                document = PDDocument.load( infile );

                if( document.isEncrypted() )
                {
                    DecryptionMaterial decryptionMaterial = null;
                    if( keyStore != null )
                    {
                        KeyStore ks = KeyStore.getInstance("PKCS12");
                        ks.load(new FileInputStream(keyStore), password.toCharArray());
View Full Code Here


        }
        else
        {
            doc = PDDocument.load(new ByteArrayInputStream(inputFileAsByteArray));
            Assert.assertTrue(doc.isEncrypted());
            DecryptionMaterial decryptionMaterial = new StandardDecryptionMaterial(password);
            doc.openProtection(decryptionMaterial);
        }
        AccessPermission currentAccessPermission = doc.getCurrentAccessPermission();

        // check permissions
View Full Code Here

        }
        else
        {
            encryptedDoc = PDDocument.load(pdfFile);
            Assert.assertTrue(encryptedDoc.isEncrypted());
            DecryptionMaterial decryptionMaterial = new StandardDecryptionMaterial(ownerpassword);
            encryptedDoc.openProtection(decryptionMaterial);
        }
        Assert.assertTrue(encryptedDoc.getCurrentAccessPermission().isOwnerPermission());
        encryptedDoc.close();

        // test with owner password => restricted permissions
        if (nonSeq)
        {
            encryptedDoc = PDDocument.loadNonSeq(pdfFile, userpassword);
        }
        else
        {
            encryptedDoc = PDDocument.load(pdfFile);
            Assert.assertTrue(encryptedDoc.isEncrypted());
            DecryptionMaterial decryptionMaterial = new StandardDecryptionMaterial(userpassword);
            encryptedDoc.openProtection(decryptionMaterial);
        }
        Assert.assertFalse(encryptedDoc.getCurrentAccessPermission().isOwnerPermission());

        assertEquals(permission.getPermissionBytes(), encryptedDoc.getCurrentAccessPermission().getPermissionBytes());
View Full Code Here

            }
            try
            {
                PDEncryption encryption = new PDEncryption(document.getEncryptionDictionary());

                DecryptionMaterial decryptionMaterial;
                if (keyStoreFilename != null)
                {
                    KeyStore ks = KeyStore.getInstance("PKCS12");
                    ks.load(new FileInputStream(keyStoreFilename), password.toCharArray());
View Full Code Here

            }
            try
            {
                PDEncryptionDictionary encParameters = new PDEncryptionDictionary(document.getEncryptionDictionary());

                DecryptionMaterial decryptionMaterial = null;
                if (keyStoreFilename != null)
                {
                    KeyStore ks = KeyStore.getInstance("PKCS12");
                    ks.load(new FileInputStream(keyStoreFilename), password.toCharArray());
View Full Code Here

            }
            try
            {
                PDEncryptionDictionary encParameters = new PDEncryptionDictionary(document.getEncryptionDictionary());

                DecryptionMaterial decryptionMaterial = null;
                if (keyStoreFilename != null)
                {
                    KeyStore ks = KeyStore.getInstance("PKCS12");
                    ks.load(new FileInputStream(keyStoreFilename), password.toCharArray());
View Full Code Here

            }
            try
            {
                PDEncryptionDictionary encParameters = new PDEncryptionDictionary(document.getEncryptionDictionary());

                DecryptionMaterial decryptionMaterial = null;
                if (keyStoreFilename != null)
                {
                    KeyStore ks = KeyStore.getInstance("PKCS12");
                    ks.load(new FileInputStream(keyStoreFilename), password.toCharArray());
View Full Code Here

           
            try
            {
                PDEncryptionDictionary encParameters = new PDEncryptionDictionary( document.getEncryptionDictionary() );
                     
                DecryptionMaterial decryptionMaterial = null;
                if( keyStoreFilename != null )
                {
                    KeyStore ks = KeyStore.getInstance( "PKCS12" );
                    ks.load( new FileInputStream( keyStoreFilename ), password.toCharArray() );
                   
View Full Code Here

            {
                document = PDDocument.load( infile );

                if( document.isEncrypted() )
                {
                    DecryptionMaterial decryptionMaterial = null;
                    if( keyStore != null )
                    {
                        KeyStore ks = KeyStore.getInstance("PKCS12");
                        ks.load(new FileInputStream(keyStore), password.toCharArray());
View Full Code Here

            {
                document = PDDocument.load( infile );

                if( document.isEncrypted() )
                {
                    DecryptionMaterial decryptionMaterial = null;
                    if( keyStore != null )
                    {
                        KeyStore ks = KeyStore.getInstance("PKCS12");
                        ks.load(new FileInputStream(keyStore), password.toCharArray());
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.pdmodel.encryption.DecryptionMaterial

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.