Examples of openProtection()


Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

                    if( document.isEncrypted() )
                    {

                        StandardDecryptionMaterial spm = new StandardDecryptionMaterial(password);
                        document.openProtection(spm);
                        AccessPermission ap = document.getCurrentAccessPermission();


                        if( ! ap.canExtractContent() )
                        {
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

                    }
                    else
                    {
                        decryptionMaterial = new StandardDecryptionMaterial(password);
                    }
                    document.openProtection(decryptionMaterial);
                    AccessPermission ap = document.getCurrentAccessPermission();
                    if(ap.isOwnerPermission())
                    {
                        document.save( outfile );
                    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

        PDDocument encrypted = reload(document);
        try
        {
            Assert.assertTrue(encrypted.isEncrypted());
            encrypted.openProtection(decryption2);
            fail("No exception when using an incorrect decryption key");
        }
        catch(CryptographyException expected)
        {
            // do nothing
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

        PDDocument encrypted = reload(document);
        try
        {
            Assert.assertTrue(encrypted.isEncrypted());
            encrypted.openProtection(decryption1);

            AccessPermission permission =
                encrypted.getCurrentAccessPermission();
            Assert.assertFalse(permission.canAssembleDocument());
            Assert.assertFalse(permission.canExtractContent());
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

        // open first time
        PDDocument encrypted1 = reload(document);
        try
        {
            encrypted1.openProtection(decryption1);

            AccessPermission permission =
                encrypted1.getCurrentAccessPermission();
            Assert.assertFalse(permission.canAssembleDocument());
            Assert.assertFalse(permission.canExtractContent());
View Full Code Here

Examples of org.pdfbox.pdmodel.PDDocument.openProtection()

        PDDocument docOpen1 = PDDocument.load(output);
       
        KeyStore ks1 = KeyStore.getInstance("PKCS12");       
        ks1.load(new FileInputStream(privateCert1), password1.toCharArray());           
        PublicKeyDecryptionMaterial pdm = new PublicKeyDecryptionMaterial(ks1, null, password1);       
        docOpen1.openProtection(pdm);       
        docOpen1.close();

        /* open second time */
       
        PDDocument docOpen2 = PDDocument.load(output);
View Full Code Here

Examples of org.pdfbox.pdmodel.PDDocument.openProtection()

        PDDocument docOpen2 = PDDocument.load(output);
       
        KeyStore ks2 = KeyStore.getInstance("PKCS12");       
        ks2.load(new FileInputStream(privateCert2), password2.toCharArray());           
        PublicKeyDecryptionMaterial pdm2 = new PublicKeyDecryptionMaterial(ks2, null, password2);       
        docOpen2.openProtection(pdm2);       
        docOpen2.close();
               
    }
   
   
View Full Code Here

Examples of org.pdfbox.pdmodel.PDDocument.openProtection()

                    }
                    else
                    {
                        decryptionMaterial = new StandardDecryptionMaterial(password);
                    }
                    document.openProtection(decryptionMaterial);
                    AccessPermission ap = document.getCurrentAccessPermission();
                    if(ap.isOwnerPermission())
                    {
                        document.save( outfile );
                    }
View Full Code Here

Examples of org.pdfbox.pdmodel.PDDocument.openProtection()

   
                    if( document.isEncrypted() )
                    {
                   
                        StandardDecryptionMaterial spm = new StandardDecryptionMaterial(password);
                        document.openProtection(spm);
                        AccessPermission ap = document.getCurrentAccessPermission();
                           
                       
                        if( ! ap.canExtractContent() )
                        {
View Full Code Here

Examples of org.pdfbox.pdmodel.PDDocument.openProtection()

   
                //document.print();
                if( document.isEncrypted() )
                {
                    StandardDecryptionMaterial sdm = new StandardDecryptionMaterial( password );                   
                    document.openProtection( sdm );
                    AccessPermission ap = document.getCurrentAccessPermission();
                   
                    if( ! ap.canExtractContent() )
                    {
                        throw new IOException( "You do not have permission to extract text" );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.