Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java Wed Mar 12 05:50:43 2014 @@ -27,7 +27,6 @@ import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSString; import org.apache.pdfbox.encryption.ARCFour; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.pdmodel.PDDocument; /** @@ -124,10 +123,9 @@ public final class StandardSecurityHandl * @param decryptionMaterial Information used to decrypt the document. * * @throws IOException If there is an error accessing data. - * @throws CryptographyException If there is an error with decryption. */ public void decryptDocument(PDDocument doc, DecryptionMaterial decryptionMaterial) - throws CryptographyException, IOException + throws IOException { document = doc; @@ -136,7 +134,7 @@ public final class StandardSecurityHandl prepareForDecryption(dictionary, documentIDArray, decryptionMaterial); - this.proceedDecryption(); + proceedDecryption(); } /** @@ -150,16 +148,14 @@ public final class StandardSecurityHandl * @param decryptionMaterial Information used to decrypt the document. * * @throws IOException If there is an error accessing data. - * @throws CryptographyException If there is an error with decryption. */ public void prepareForDecryption(PDEncryptionDictionary encDictionary, COSArray documentIDArray, DecryptionMaterial decryptionMaterial) - throws CryptographyException, IOException + throws IOException { if(!(decryptionMaterial instanceof StandardDecryptionMaterial)) { - throw new CryptographyException("Provided decryption material is not compatible " + - "with the document"); + throw new IOException("Decryption material is not compatible with the document"); } StandardDecryptionMaterial material = (StandardDecryptionMaterial)decryptionMaterial; @@ -227,8 +223,8 @@ public final class StandardSecurityHandl } else { - throw new CryptographyException("The supplied password does not match either the " + - "owner or user password in the document" ); + // TODO perhaps we could return a boolean to indicate if the password was correct + throw new IOException("Cannot decrypt PDF, the password is incorrect"); } // detect whether AES encryption is used. This assumes that the encryption algo is @@ -251,10 +247,8 @@ public final class StandardSecurityHandl * @param doc The documeent to encrypt. * * @throws IOException If there is an error accessing data. - * @throws CryptographyException If there is an error with decryption. */ - public void prepareDocumentForEncryption(PDDocument doc) - throws CryptographyException, IOException + public void prepareDocumentForEncryption(PDDocument doc) throws IOException { document = doc; PDEncryptionDictionary encryptionDictionary = document.getEncryptionDictionary(); @@ -343,13 +337,12 @@ public final class StandardSecurityHandl * * @return True If the ownerPassword param is the owner password. * - * @throws CryptographyException If there is an error during encryption. * @throws IOException If there is an error accessing data. */ public final boolean isOwnerPassword(byte[] ownerPassword, byte[] user, byte[] owner, int permissions, byte[] id, int encRevision, int length, boolean encryptMetadata) - throws CryptographyException, IOException + throws IOException { byte[] userPassword = getUserPassword( ownerPassword, owner, encRevision, length ); return isUserPassword( userPassword, user, owner, permissions, id, encRevision, length, @@ -366,11 +359,10 @@ public final class StandardSecurityHandl * * @return The u entry of the encryption dictionary. * - * @throws CryptographyException If there is an error generating the user password. * @throws IOException If there is an error accessing data while generating the user password. */ public final byte[] getUserPassword( byte[] ownerPassword, byte[] owner, int encRevision, - long length ) throws CryptographyException, IOException + long length ) throws IOException { ByteArrayOutputStream result = new ByteArrayOutputStream(); @@ -391,8 +383,7 @@ public final class StandardSecurityHandl } if( encRevision == 2 && length != 5 ) { - throw new CryptographyException( - "Error: Expected length=5 actual=" + length ); + throw new IOException("Error: Expected length=5 actual=" + length ); } byte[] rc4Key = new byte[ (int)length ]; @@ -439,11 +430,11 @@ public final class StandardSecurityHandl * * @return The encrypted key bytes. * - * @throws CryptographyException If there is an error with encryption. + * @throws IOException If there is an error with encryption. */ public final byte[] computeEncryptedKey(byte[] password, byte[] o, int permissions, byte[] id, int encRevision, int length, boolean encryptMetadata) - throws CryptographyException + throws IOException { byte[] result = new byte[ length ]; @@ -483,7 +474,7 @@ public final class StandardSecurityHandl if( encRevision == 2 && length != 5 ) { - throw new CryptographyException( + throw new IOException( "Error: length should be 5 when revision is two actual=" + length ); } System.arraycopy( digest, 0, result, 0, length ); @@ -504,13 +495,12 @@ public final class StandardSecurityHandl * * @return The user password. * - * @throws CryptographyException If there is an error computing the user password. - * @throws IOException If there is an IO error. + * @throws IOException if the password could not be computed */ public final byte[] computeUserPassword(byte[] password, byte[] owner, int permissions, byte[] id, int encRevision, int length, boolean encryptMetadata) - throws CryptographyException, IOException + throws IOException { ByteArrayOutputStream result = new ByteArrayOutputStream(); byte[] encryptionKey = computeEncryptedKey( password, owner, permissions, id, encRevision, @@ -562,12 +552,11 @@ public final class StandardSecurityHandl * * @return The o entry of the encryption dictionary. * - * @throws CryptographyException If there is an error with encryption. - * @throws IOException If there is an error accessing data. + * @throws IOException if the owner password could not be computed */ public final byte[] computeOwnerPassword(byte[] ownerPassword, byte[] userPassword, int encRevision, int length ) - throws CryptographyException, IOException + throws IOException { byte[] ownerPadded = truncateOrPad( ownerPassword ); @@ -586,7 +575,7 @@ public final class StandardSecurityHandl } if( encRevision == 2 && length != 5 ) { - throw new CryptographyException("Expected length=5 actual=" + length ); + throw new IOException("Expected length=5 actual=" + length ); } byte[] rc4Key = new byte[ length ]; @@ -648,13 +637,12 @@ public final class StandardSecurityHandl * * @return true If the plaintext password is the user password. * - * @throws CryptographyException If there is an error during encryption. * @throws IOException If there is an error accessing data. */ public final boolean isUserPassword(byte[] password, byte[] user, byte[] owner, int permissions, byte[] id, int encRevision, int length, boolean encryptMetadata) - throws CryptographyException, IOException + throws IOException { byte[] passwordBytes = computeUserPassword( password, owner, permissions, id, encRevision, length, encryptMetadata ); @@ -686,13 +674,11 @@ public final class StandardSecurityHandl * * @return true If the plaintext password is the user password. * - * @throws CryptographyException If there is an error during encryption. * @throws IOException If there is an error accessing data. */ public final boolean isUserPassword(String password, byte[] user, byte[] owner, int permissions, byte[] id, int encRevision, int length, - boolean encryptMetadata) - throws CryptographyException, IOException + boolean encryptMetadata) throws IOException { return isUserPassword(password.getBytes("ISO-8859-1"), user, owner, permissions, id, encRevision, length, encryptMetadata); @@ -712,13 +698,11 @@ public final class StandardSecurityHandl * * @return True If the ownerPassword param is the owner password. * - * @throws CryptographyException If there is an error during encryption. * @throws IOException If there is an error accessing data. */ public final boolean isOwnerPassword(String password, byte[] user, byte[] owner, int permissions, byte[] id, int encRevision, int length, - boolean encryptMetadata) - throws CryptographyException, IOException + boolean encryptMetadata) throws IOException { return isOwnerPassword(password.getBytes("ISO-8859-1"), user,owner,permissions, id, encRevision, length, encryptMetadata);
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java Wed Mar 12 05:50:43 2014 @@ -31,7 +31,6 @@ import org.apache.pdfbox.cos.COSDictiona import org.apache.pdfbox.cos.COSDocument; import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.SignatureException; import org.apache.pdfbox.pdfparser.PDFParser; @@ -255,8 +254,7 @@ public class FDFDocument * * @throws IOException If there is an error saving the document. */ - public void save( File fileName ) - throws IOException, CryptographyException, SignatureException + public void save( File fileName ) throws IOException, SignatureException { save( new FileOutputStream( fileName ) ); } @@ -268,8 +266,7 @@ public class FDFDocument * * @throws IOException If there is an error saving the document. */ - public void save( String fileName ) - throws IOException, CryptographyException, SignatureException + public void save( String fileName ) throws IOException, SignatureException { save( new FileOutputStream( fileName ) ); } @@ -280,11 +277,9 @@ public class FDFDocument * @param output The stream to write to. * * @throws IOException If there is an error writing the document. - * @throws CryptographyException If there is an error writing the document. * @throws SignatureException If there is an error writing the document. */ - public void save( OutputStream output ) - throws IOException, CryptographyException, SignatureException + public void save( OutputStream output ) throws IOException, SignatureException { COSWriter writer = null; try Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java Wed Mar 12 05:50:43 2014 @@ -23,7 +23,6 @@ import java.io.InputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.SignatureException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; @@ -71,7 +70,7 @@ public class PDFTemplateCreator * @throws IOException */ public InputStream buildPDF(PDVisibleSignDesigner properties) - throws IOException, CryptographyException, SignatureException + throws IOException, SignatureException { logger.info("pdf building has been started"); PDFTemplateStructure pdfStructure = pdfBuilder.getStructure(); Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java Wed Mar 12 05:50:43 2014 @@ -25,7 +25,6 @@ import java.util.List; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSDocument; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.SignatureException; import org.apache.pdfbox.pdfwriter.COSWriter; import org.apache.pdfbox.pdmodel.PDDocument; @@ -576,8 +575,7 @@ public class PDFTemplateStructure * @return * @throws IOException */ - public ByteArrayInputStream getTemplateAppearanceStream() - throws IOException, CryptographyException, SignatureException + public ByteArrayInputStream getTemplateAppearanceStream() throws IOException, SignatureException { COSDocument visualSignature = getVisualSignature(); ByteArrayOutputStream memoryOut = new ByteArrayOutputStream(); Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigProperties.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigProperties.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigProperties.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigProperties.java Wed Mar 12 05:50:43 2014 @@ -16,7 +16,6 @@ */ package org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.SignatureException; import java.io.IOException; @@ -44,11 +43,10 @@ public class PDVisibleSigProperties * start building of visible signature * * @throws IOException if the output could not be written - * @throws CryptographyException if something went wrong during a cryptography operation * @throws SignatureException if signing failed */ public void buildSignature() - throws IOException, CryptographyException, SignatureException + throws IOException, SignatureException { PDFTemplateBuilder builder = new PDVisibleSigBuilder(); PDFTemplateCreator creator = new PDFTemplateCreator(builder); Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFMergerUtility.java Wed Mar 12 05:50:43 2014 @@ -34,7 +34,6 @@ import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSNumber; import org.apache.pdfbox.cos.COSStream; import org.apache.pdfbox.cos.COSString; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.SignatureException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocumentCatalog; @@ -175,8 +174,7 @@ public class PDFMergerUtility * * @throws IOException If there is an error saving the document. */ - public void mergeDocuments() - throws IOException, CryptographyException, SignatureException + public void mergeDocuments() throws IOException, SignatureException { PDDocument destination = null; InputStream sourceFile; Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java Wed Mar 12 05:50:43 2014 @@ -36,7 +36,6 @@ import java.util.regex.Pattern; import org.apache.pdfbox.cos.COSDocument; import org.apache.pdfbox.cos.COSStream; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.InvalidPasswordException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; @@ -50,7 +49,6 @@ import org.apache.pdfbox.text.TextNormal import org.apache.pdfbox.text.TextPosition; import org.apache.pdfbox.text.TextPositionComparator; - /** * This class will take a pdf document and strip out all of the text and ignore the * formatting and such. Please note; it is up to clients of this class to verify that @@ -340,10 +338,6 @@ public class PDFTextStripper extends PDF { document.decrypt(""); } - catch (CryptographyException e) - { - throw new IOException("Could not decrypt document", e); - } catch (InvalidPasswordException e) { throw new IOException("Invalid password for encrypted document", e); Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSBase.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSBase.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSBase.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSBase.java Wed Mar 12 05:50:43 2014 @@ -19,7 +19,6 @@ package org.apache.pdfbox.cos; import junit.framework.TestCase; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.SignatureException; import java.io.IOException; @@ -43,8 +42,7 @@ public abstract class TestCOSBase extend /** * Test accept() - tests the interface for visiting a document at the COS level. */ - public abstract void testAccept() - throws IOException, CryptographyException, SignatureException; + public abstract void testAccept() throws IOException, SignatureException; /** * Tests isNeedToBeUpdate() and setNeedToBeUpdate() - tests the getter/setter methods. @@ -70,8 +68,8 @@ public abstract class TestCOSBase extend /** * A simple utility function to compare two byte arrays. - * @param str1 the expected byte array - * @param str2 the byte array being compared + * @param byteArr1 the expected byte array + * @param byteArr2 the byte array being compared */ protected void testByteArrays(byte[] byteArr1, byte[] byteArr2) { Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSString.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSString.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSString.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSString.java Wed Mar 12 05:50:43 2014 @@ -20,7 +20,6 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.SignatureException; import org.apache.pdfbox.pdfwriter.COSWriter; @@ -320,8 +319,7 @@ public class TestCOSString extends TestC } @Override - public void testAccept() - throws IOException, CryptographyException, SignatureException + public void testAccept() throws IOException, SignatureException { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); ICOSVisitor visitor = new COSWriter(outStream); Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java Wed Mar 12 05:50:43 2014 @@ -28,7 +28,6 @@ import java.security.cert.X509Certificat import junit.framework.Assert; import junit.framework.TestCase; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.SignatureException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.encryption.AccessPermission; @@ -129,11 +128,7 @@ public class TestPublicKeyEncryption ext Assert.assertTrue(encrypted.isEncrypted()); encrypted.openProtection(decryption2); fail("No exception when using an incorrect decryption key"); - } - catch(CryptographyException expected) - { - // do nothing - } + } finally { encrypted.close(); @@ -243,7 +238,7 @@ public class TestPublicKeyEncryption ext * @throws Exception if */ private PDDocument reload(PDDocument doc) - throws IOException, CryptographyException, SignatureException, NoSuchAlgorithmException + throws IOException, SignatureException, NoSuchAlgorithmException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); doc.save(buffer); Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java Wed Mar 12 05:50:43 2014 @@ -24,7 +24,6 @@ import java.io.IOException; import java.io.InputStream; import java.util.Arrays; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.SignatureException; import org.apache.pdfbox.io.IOUtils; import org.apache.pdfbox.io.RandomAccessBuffer; @@ -49,8 +48,7 @@ public class TestPDDocument extends Test /** * Test document save/load using a stream. */ - public void testSaveLoadStream() - throws IOException, CryptographyException, SignatureException + public void testSaveLoadStream() throws IOException, SignatureException { // Create PDF with one blank page PDDocument document = new PDDocument(); @@ -76,8 +74,7 @@ public class TestPDDocument extends Test /** * Test document save/load using a file. */ - public void testSaveLoadFile() - throws IOException, CryptographyException, SignatureException + public void testSaveLoadFile() throws IOException, SignatureException { // Create PDF with one blank page PDDocument document = new PDDocument(); @@ -106,8 +103,7 @@ public class TestPDDocument extends Test /** * Test document save/loadNonSeq using a stream. */ - public void testSaveLoadNonSeqStream() - throws IOException, CryptographyException, SignatureException + public void testSaveLoadNonSeqStream() throws IOException, SignatureException { // Create PDF with one blank page PDDocument document = new PDDocument(); @@ -133,8 +129,7 @@ public class TestPDDocument extends Test /** * Test document save/loadNonSeq using a file. */ - public void testSaveLoadNonSeqFile() - throws IOException, CryptographyException, SignatureException + public void testSaveLoadNonSeqFile() throws IOException, SignatureException { // Create PDF with one blank page PDDocument document = new PDDocument(); Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java Wed Mar 12 05:50:43 2014 @@ -24,7 +24,6 @@ import java.io.IOException; import junit.framework.TestCase; import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.SignatureException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocumentCatalog; @@ -118,8 +117,7 @@ public class TestLayerUtility extends Te } } - private File createMainPDF() - throws IOException, CryptographyException, SignatureException + private File createMainPDF() throws IOException, SignatureException { File targetFile = new File(testResultsDir, "text-doc.pdf"); PDDocument doc = new PDDocument(); @@ -174,8 +172,7 @@ public class TestLayerUtility extends Te return targetFile; } - private File createOverlay1() - throws IOException, CryptographyException, SignatureException + private File createOverlay1() throws IOException, SignatureException { File targetFile = new File(testResultsDir, "overlay1.pdf"); PDDocument doc = new PDDocument(); Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/parser/PreflightParser.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/parser/PreflightParser.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/parser/PreflightParser.java (original) +++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/parser/PreflightParser.java Wed Mar 12 05:50:43 2014 @@ -69,7 +69,6 @@ import org.apache.pdfbox.cos.COSNumber; import org.apache.pdfbox.cos.COSObject; import org.apache.pdfbox.cos.COSStream; import org.apache.pdfbox.cos.COSString; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.io.IOUtils; import org.apache.pdfbox.io.RandomAccess; import org.apache.pdfbox.pdfparser.BaseParser; @@ -727,16 +726,7 @@ public class PreflightParser extends Non COSStream stream = parseCOSStream((COSDictionary) pb, getDocument().getScratchFile()); if (securityHandler != null) { - try - { - securityHandler.decryptStream(stream, objNr, objGenNr); - } - catch (CryptographyException ce) - { - throw new IOException("Error decrypting stream object " + objNr + ": " - + ce.getMessage() - /* , ce // TODO: remove remark with Java 1.6 */); - } + securityHandler.decryptStream(stream, objNr, objGenNr); } pb = stream; } Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java (original) +++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/OverlayPDF.java Wed Mar 12 05:50:43 2014 @@ -34,7 +34,6 @@ import org.apache.pdfbox.cos.COSInteger; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSObject; import org.apache.pdfbox.cos.COSStream; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.SignatureException; import org.apache.pdfbox.io.RandomAccessBuffer; import org.apache.pdfbox.pdfparser.BaseParser; @@ -213,7 +212,7 @@ public class OverlayPDF * @param specificPageOverlayFile map of overlay files for specific pages */ public void overlay(Map<Integer, String> specificPageOverlayFile) - throws IOException, CryptographyException, SignatureException + throws IOException, SignatureException { PDDocument sourcePDFDocument = null; PDDocument defaultOverlay = null; Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFDebugger.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFDebugger.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFDebugger.java (original) +++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFDebugger.java Wed Mar 12 05:50:43 2014 @@ -414,10 +414,6 @@ public class PDFDebugger extends javax.s { System.err.println( "Error: The document is encrypted." ); } - catch( org.apache.pdfbox.exceptions.CryptographyException e ) - { - e.printStackTrace(); - } } } } Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFReader.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFReader.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFReader.java (original) +++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFReader.java Wed Mar 12 05:50:43 2014 @@ -385,10 +385,6 @@ public class PDFReader extends JFrame { System.err.println("Error: The document is encrypted."); } - catch (org.apache.pdfbox.exceptions.CryptographyException e) - { - e.printStackTrace(); - } } } } Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFSplit.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFSplit.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFSplit.java (original) +++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFSplit.java Wed Mar 12 05:50:43 2014 @@ -22,7 +22,6 @@ import java.io.FileOutputStream; import java.util.List; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.InvalidPasswordException; import org.apache.pdfbox.exceptions.SignatureException; @@ -221,7 +220,7 @@ public class PDFSplit } private static final void writeDocument( PDDocument doc, String fileName ) - throws IOException, CryptographyException, SignatureException + throws IOException, SignatureException { FileOutputStream output = null; COSWriter writer = null; Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java (original) +++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java Wed Mar 12 05:50:43 2014 @@ -25,7 +25,6 @@ import java.util.List; import javax.imageio.ImageIO; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.InvalidPasswordException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; @@ -68,7 +67,7 @@ public class PDFToImage * * @throws Exception If there is an error parsing the document. */ - public static void main( String[] args ) throws IOException, CryptographyException + public static void main( String[] args ) throws IOException { boolean useNonSeqParser = false; String password = ""; Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java?rev=1576587&r1=1576586&r2=1576587&view=diff ============================================================================== --- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java (original) +++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java Wed Mar 12 05:50:43 2014 @@ -25,7 +25,6 @@ import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSObject; import org.apache.pdfbox.cos.COSStream; -import org.apache.pdfbox.exceptions.CryptographyException; import org.apache.pdfbox.exceptions.SignatureException; import org.apache.pdfbox.pdmodel.PDDocument; @@ -58,13 +57,12 @@ public class WriteDecodedDoc * @param out The filename used for output. * * @throws IOException if the output could not be written - * @throws CryptographyException if something went wrong during a cryptography operation * @throws SignatureException if signing failed * * @deprecated use {@link WriteDecodedDoc#doIt(String, String, String, boolean)} instead. */ public void doIt(String in, String out) - throws IOException, CryptographyException, SignatureException + throws IOException, SignatureException { doIt(in, out, "", false); } @@ -78,11 +76,10 @@ public class WriteDecodedDoc * @param useNonSeqParser use the non sequential parser * * @throws IOException if the output could not be written - * @throws CryptographyException if something went wrong during a cryptography operation * @throws SignatureException if signing failed */ public void doIt(String in, String out, String password, boolean useNonSeqParser) - throws IOException, CryptographyException, SignatureException + throws IOException, SignatureException { PDDocument doc = null; try @@ -114,11 +111,6 @@ public class WriteDecodedDoc } return; } - catch( org.apache.pdfbox.exceptions.CryptographyException e ) - { - e.printStackTrace(); - return; - } } } for (Iterator<COSObject> i = doc.getDocument().getObjects().iterator(); i.hasNext();)