Print Page | Close Window

special pdf library for AES 128-bit encryption

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=627
Printed Date: 23 Nov 24 at 12:17AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: special pdf library for AES 128-bit encryption
Posted By: Ingo
Subject: special pdf library for AES 128-bit encryption
Date Posted: 06 Feb 07 at 8:51AM
Hi!

I'm asking myself if i should complete the functionality of the QuickPDF-library with the new AES 128-bit-encryption and -decryption to be more compatible with the 1.6 specs.
Are there stable libraries available for this special part of pdf-functionality?
For Delphi or VB2005 Express... for commercial use...?
Thanks a lot in advance.

Best regards,
Ingo




Replies:
Posted By: Ingo
Date Posted: 18 Feb 07 at 5:02PM
Hi!

I've found the PDFsecure SDK from PDFtron (Canadian company)...
Less functions and nice price but encrypt/decrypt for the 1.6 specs - a good addition to QuickPDF? Is here anybody using this product or having more information about it? Will the company be alive tomorrow?

Best regards,
Ingo


Posted By: Wheeley
Date Posted: 18 Feb 07 at 8:27PM
I have found in searching that ITextSharp which is a freeware PDF creation tool supposedly supports 128aes in newer releases. Here is where I found this out:

http://blog.rubypdf.com/2006/12/19/itext147-and-itextsharp317-supports-aes-encryption/

And here is where you can get a DLL and source code"

http://sourceforge.net/projects/itextsharp/

Good luck
Wheeley

Big%20smile


Posted By: Ingo
Date Posted: 19 Feb 07 at 1:49AM
Hi Wheeley!

Thanks but ... I'm using Delphi ;-)

Best regards,
Ingo


Posted By: chicks
Date Posted: 19 Feb 07 at 11:27AM
Originally posted by Ingo Ingo wrote:

Thanks but ... I'm using Delphi ;-)


Ingo,

It's possible, using gcc/gcj and MinGW/MSYS, to compile the java version of iText to a native Windows DLL, which can be used from most compiled languages, including (I suspect) Delphi.

Here's an example iText DLL for fdf merging:

http://www.esnips.com/web/PDFTools?docsPage=3#files - iText FDF DLL

If you can specify exactly what you need the lib to do, maybe I can create a DLL to do it.


Posted By: Ingo
Date Posted: 20 Feb 07 at 2:00AM
Hi Chicks!

Thanks for your kind offer!
You know what i'm missing most in our favourite PDF-library...
It's the aes 128 bit en-/decryption with supported passwords.
A dll with encryption, decryption and password setting was great.
If you can create such a dll - tell me what i can do for you.
ingo[dot]schmoekel[at]ewetel[dot]net
If it works we should offer it here in our download section...

Best regards,
Ingo




Posted By: chicks
Date Posted: 21 Feb 07 at 11:50AM
Hi Ingo.

OK, I'll look into it. It will require compiling the latest version of iText (I'm currently a couple of versions behind), and probably requires AES support in libgcj under MinGW, which may or may not be there. We'll see. This could take a week or two, if it's possible.

Meanwhile, here's a compiled commandline version of a util to encrypt using the standard RC4 encryption:

http://www.esnips.com/web/PDFTools?docsPage=3#files



Posted By: Ingo
Date Posted: 21 Feb 07 at 12:24PM
Hi Chicks!

Thanks a lot!
I've already waited a long time ... so a week more doesn't matter ;-)

Best regards,
Ingo



Posted By: chicks
Date Posted: 21 Feb 07 at 1:05PM
I've been poking around in the source for libgcj under the latest version of MinGW, and don't find a AES provider

Here's the top-level class descriptor:

    super("GNU", 1.0, "GNU provider v1.0 implementing SHA-1, MD5, DSA, X.509 Certificates");

Does AES fall under any of these?


Posted By: Ingo
Date Posted: 21 Feb 07 at 3:14PM
Hi Chicks!

I don't think so :-(  ...But i don't know ;-)
Above Wheeley told from the AES-functionality in iTextSharp and 'cause iTextSharp is closely related to the java-version of iText i've thought ...
What i don't understand is why you're searching in libgcj? I think if it's in iText that's all you need? Silly question? ...Where can i read more about it?

Thanks a lot!
Ingo



Posted By: chicks
Date Posted: 21 Feb 07 at 3:46PM
Ingo,

Because iText uses the underlying java runtime for its encryption functionality. To compile it to native Windows, gcc uses libgcj, which is a compiled, open source version of the java runtime libraries. It's not 100% complete, so it may not have the AES functionality in it.

You might also be able to interface with the iTextSharp port from Delphi (I don't know), but that would require the .NET runtime to be installed, which is where the encryption functionality would be for that version.


Posted By: chicks
Date Posted: 22 Feb 07 at 4:27PM
Ingo,

I got the encrypt_pdf java class AES-128 working with the latest version of the iText java lib.

However, there are several issues that will probably prevent compilation to a Windows DLL.

First, the jre 1.2 version of iText that I need in order to compile with gcj is not being kept up to date. Next, the iText developers are now using the BouncyCastle jars for all encryption, and I can't get the BouncyCastle jars to compile under gcj.

Doesn't look promising at this point. If you just want a commandline version that requires the java runtime and a few jar files, I can provide that today. It would likely be very easy to port to .NET using iTextSharp, since Bouncycastle also has a C# version of their libs.


Posted By: chicks
Date Posted: 23 Feb 07 at 4:46PM
Ingo,

Made considerable progress. Using JavaNativeCompiler and the previous (1.4.8) version of iText, which still has the Bouncycastle stuff built-in, I was able to compile encrypt_pdf to a native Windows commandline .exe, with optional AES encryption.

I'll work on the decrypt portion, and more logical arguments. Right now, it's popping up a "demo" dialog, since I don't yet have the licensed version of JavaNativeCompiler, but I'll post the .exe once that's taken care of.

JavaNativeCompiler is only set up to produce Windows and Linux .exe's, not DLL's, so no luck yet with that part.

The 1.4.8 version of iText is pretty comprehensive, so I may want to add some other things that are missing from pdftk, besides AES encryption, like xfdf support, etc.


Posted By: Ingo
Date Posted: 24 Feb 07 at 7:22AM
Hi Chicks!

It sounds already great!
How much costs the JavaNativeCompiler?
An exe instead of a dll isn't too bad (better then no aes ;-)
I think aes is the new encryption standard from adobe and if we want to go with the time WITH quickpdf we should include it in the near future. I think it's VERY difficult to implement it directly into the library but if we can offer an extra tool - why not ;-)

Thanks a lot!!!
Ingo



Posted By: chicks
Date Posted: 24 Feb 07 at 1:49PM
OK, the commandline encryption tool is available here:

http://www.esnips.com/web/PDFTools?docsPage=3#files - encrypt_pdf

I haven't attempted to alter the iText tool in any way, other than adding support for AES-128 encryption. No decryption yet, will probably try to remodel the args list more like that of the PDFTron tool mentioned above.

JavaNativeCompiler is just $40 US, a bargain compared to the hassle of trying to keep up to date with gcc/gcj under Windows. The MSYS/MinGW stuff is way behind. Marco has packaged MSYS/MinGW, gcc/gcj, the latest version of Gnu Classpath, and upx into a single, utterly simple compiler. Very nice stuff, ideal for building compiled commandline utils around iText (at least the previous version, for now). The only down side is the size of the .exe, which has to include a lot unused code, such has the entire AWT library, because it's referenced in iText.

Here's a usage example:

encrypt_pdf f1040ez.pdf out.pdf "" "Top Secret" 10100000 AES Title "2005 Form 1040EZ" Author chicks Subject "2005 Income Tax Return" Keywords "Painful IRS Tax Burden"



Posted By: Ingo
Date Posted: 25 Feb 07 at 2:50PM
Hi Chicks!

It works. Great!
i was on the website of Marco ... It's not so easy making an exe from any java-program (it's not bad to have a bit java knowledge)  :-))
If you still don't have the JavaNativeCompiler i'll buy it for you - is it okay?

Sure... QuickPDF isn't bugfree... but bugs we can solve ;-)   New enhancements are much more complicated. A feature like aes goes through many modules and isn't easy to handle. So i think it's a good idea creating a dll or commandline-program adding encryption and decryption with aes  to our library. What do you think?

One problem i've seen while testing your comandline-version. AES-encryption was included but there's still the version 1.3 in my testfile. I think it should be at least 1.5? But okay ... we can do this separate with QuickPDF. The second point is the big exe-file ... Do you think you can make it a bit smaller? I've tried it with  PECompact but i've got not one byte success.

If you can implement decryption, too and if it's a bit smaller we should offer this tool here in the download section for all registered users?

Best regards and thanks a lot for your efforts in this case!
Ingo




Posted By: chicks
Date Posted: 25 Feb 07 at 7:53PM
Ingo,

I'm thinking of providing other encryption-related functionality, particularly digital signatures, that aren't available in QuickPDF or pdftk.

Paulo (one of the iText developers) shows how to do a number of signature-related things here: http://itextpdf.sourceforge.net/howtosign.html - howtosign.html

Unfortunately, there's not much hope of making the .exe smaller, as it if forced to contain a lot of things that aren't used. The good thing is that it won't get much larger, even if a good deal of new functionality is added. Note that it's already compressed (with upx), so you won't be able to compress it further.

All of the enctyption/signature stuff is working fine in iText, so won't be a problem to add to the utility. We'll just have to come up with a good name for it, and a logical argument structure.

I've already purchased JNC, and expect to get good use from it. Thanks for the offer, though.


Posted By: Ingo
Date Posted: 26 Feb 07 at 12:48AM
Originally posted by chicks chicks wrote:

We'll just have to come up with a good name for it, and a logical argument structure.
I've already purchased JNC, and expect to get good use from it. Thanks for the offer, though.


Hi Chicks!

Where can i find (not too big) good documentation about using iText with JNC? What do think about offering such an exe-tool here for our registered users for free? Could it be not legal?

Best regards,
Ingo



Posted By: chicks
Date Posted: 26 Feb 07 at 10:17AM
Ingo,

It's very easy. First, download itext-1.4.8.jar from http://sourceforge.net/project/showfiles.php?group_id=15255 - Sourceforge

Then, in JNC, select your .java files that are to be compiled, and the itext-1.4.8.jar archive file. On the next screen, select the file (normally your .java file) that has the "main" class. Default most everything, and press Compile on the final JNC screen.

The first time you compile, it will need to compile the iText library, so will take a long time. Subsequently, it will go much faster, since this only has to be done once.

Here's the source for encrypt_pdf:

//import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
import com.lowagie.text.pdf.PdfWriter;
import java.io.*;
import java.util.HashMap;

/** Encrypts a PDF document. It needs iText (http://www.lowagie.com/iText).
* @author Paulo Soares (psoares@consiste.pt)
*/
public class encrypt_pdf {
    
    private final static int INPUT_FILE = 0;
    private final static int OUTPUT_FILE = 1;
    private final static int USER_PASSWORD = 2;
    private final static int OWNER_PASSWORD = 3;
    private final static int PERMISSIONS = 4;
    private final static int STRENGTH = 5;
    private final static int MOREINFO = 6;
    private final static int permit[] = {
        PdfWriter.AllowPrinting,
        PdfWriter.AllowModifyContents,
        PdfWriter.AllowCopy,
        PdfWriter.AllowModifyAnnotations,
        PdfWriter.AllowFillIn,
        PdfWriter.AllowScreenReaders,
        PdfWriter.AllowAssembly,
        PdfWriter.AllowDegradedPrinting};

    private static void usage() {
        System.out.println("usage: input_file output_file user_password owner_password permissions AES|128|40 [new info string pairs]");
        System.out.println("permissions is 8 digit long 0 or 1. Each digit has a particular security function:");
        System.out.println();
        System.out.println("AllowPrinting");
        System.out.println("AllowModifyContents");
        System.out.println("AllowCopy");
        System.out.println("AllowModifyAnnotations");
        System.out.println("AllowFillIn (128 bit only)");
        System.out.println("AllowScreenReaders (128 bit only)");
        System.out.println("AllowAssembly (128 bit only)");
        System.out.println("AllowDegradedPrinting (128 bit only)");
        System.out.println("Example permissions to copy and print would be: 10100000");
    }
    
    public static void main (String args[]) {
        System.out.println("PDF document encryptor");
        if (args.length <= STRENGTH || args[PERMISSIONS].length() != 8) {
            usage();
            return;
        }
        try {
            int permissions = 0;
            String p = args[PERMISSIONS];
            for (int k = 0; k < p.length(); ++k) {
               permissions |= (p.charAt(k) == '0' ? 0 : permit[k]);
            }
            
               int type = PdfWriter.ENCRYPTION_RC4_40;

            if(args[STRENGTH].equals("128")) {
               type = PdfWriter.ENCRYPTION_RC4_128;
               }
            else if(args[STRENGTH].equalsIgnoreCase("AES")) {
               type = PdfWriter.ENCRYPTION_AES_128;
               }

            System.out.println("Reading " + args[INPUT_FILE]);
            PdfReader reader = new PdfReader(args[INPUT_FILE]);
            
               System.out.println("Writing " + args[OUTPUT_FILE]);

            HashMap moreInfo = new HashMap();
            for (int k = MOREINFO; k < args.length - 1; k += 2)
               moreInfo.put(args[k], args[k + 1]);

            PdfEncryptor.encrypt(reader, new FileOutputStream(args[OUTPUT_FILE]), type,
               args[USER_PASSWORD], args[OWNER_PASSWORD], permissions, moreInfo);

            System.out.println("Done.");
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Yes, it's perfectly legal. iText is dual-licensed, LGPL or MPL (your choice), and libgcj is LGPL. The LGPL is a mess, and impossible to understand, but most seem to believe that it allows distribution of derived binaries without needing to open your source. I intend to open any source code I write using iText, since my work is insignificant compared to iText and gcc/gcj/classpath.


Posted By: Ingo
Date Posted: 26 Feb 07 at 2:48PM
Hi Chicks!

Thanks for the source!
In step 4 of the JNC after pressing "compile" i got this:
" . . .
creating "encrypt_pdf.exe" for Windows
    No Windows compiler has been set!
    You can specify the compiler paths in the settings...

failed...
. . ."

Is it possible for you to send me the four JNC-windows with your settings as screenshots to ingo[dot]schmoekel[at]ewetel[dot]net?

Thanks a lot for your efforts!
Best regards,
Ingo



Posted By: chicks
Date Posted: 26 Feb 07 at 3:29PM
You need to install the "Compiler for Windows" from the JNC site. Extract it into the same directory where you installed JNC as a subdirectory, and it will auto-detect it.

For example, if you install JNC to:

    C:\Program Files\JavaNativeCompiler-1.1.1\

you should have a subdir off of that:

    gcc-122233-win\

after extracting the compiler.



Posted By: Ingo
Date Posted: 26 Feb 07 at 4:34PM
Hi again...

After 5 minutes running i've got other messages ;-)
Perhaps you can have a look on my settings in the four jnc-windows:
http://www.is-soft.de/pad/jnc1.jpg
http://www.is-soft.de/pad/jnc2.jpg
http://www.is-soft.de/pad/jnc3.jpg
http://www.is-soft.de/pad/jnc4.jpg

Best regards,
Ingo

here's the resulting window from the JNC:

creating "encrypt_pdf.exe" for Windows
- processing itext-2.0.0.jar
    com/lowagie/text/pdf/PdfPKCS7.java: In class 'com.lowagie.text.pdf.PdfPKCS7$X509Name':
    com/lowagie/text/pdf/PdfPKCS7.java: In method 'com.lowagie.text.pdf.PdfPKCS7$X509Name.<clinit>()':
    com/lowagie/text/pdf/PdfPKCS7.java:1041: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1041: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1041: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1041: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1041: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1041: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1046: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1046: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1046: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1046: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1046: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1051: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1051: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1051: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1051: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1051: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1056: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1056: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1056: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1056: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1056: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1061: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1061: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1061: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1061: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1061: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1066: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1066: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1066: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1066: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1066: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1071: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1071: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1071: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1071: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1071: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1076: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1076: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1076: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1076: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1076: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1079: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1079: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1079: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1079: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1079: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1081: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1081: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1081: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1081: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1081: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1083: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1083: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1083: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1083: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1083: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1085: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1085: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1085: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1085: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1085: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1087: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1087: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1087: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1087: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1087: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1093: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1093: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1093: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1093: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1093: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1101: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1101: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1101: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1101: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1101: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1104: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1104: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1104: error: cannot find file for class org.bouncycastle.asn1.DERObjectIdentifier
    com/lowagie/text/pdf/PdfPKCS7.java:1104: error: class 'org.bouncycastle.asn1.DERObjectIdentifier' has no method named '<init>' matching signature '(Ljava/lang/String;)V'
    com/lowagie/text/pdf/PdfPKCS7.java:1104: error: expected type 'org.bouncycastle.asn1.DERObjectIdentifier' but stack contains 'org.bouncycastle.asn1.DERObjectIdentifier'
    com/lowagie/text/pdf/PdfPKCS7.java:1041: confused by earlier errors, bailing out

failed...


Posted By: chicks
Date Posted: 26 Feb 07 at 4:37PM
Ingo,

You're using the wrong version of the iText lib. You need 1.4.8, which has the Bouncycastle stuff still built-in.

The "Directories (with subdirs)" should point to the path where your .java files are - you don't want the iText source files, just the compiled .jar file, "itext-1.4.8.jar"

You also won't need Sun's jdk to compile either, you're using gcj instead.


Posted By: Ingo
Date Posted: 27 Feb 07 at 1:02AM
Hi Chicks!

Thanks a lot for your help!!!
I'll try it this evening again...

Best regards,
Ingo



Posted By: chicks
Date Posted: 27 Feb 07 at 10:24AM
BTW, Govert is using the .NET version of iText (iTextSharp) with Turbo Delphi.NET, which might be a good fit for you Delphi guys.

See his PDFCatalogger here, under PDF tools: http://www.noliturbare.com/ - http://www.noliturbare.com/


Posted By: chicks
Date Posted: 27 Feb 07 at 1:54PM
Updated to include decryption (assuming you know the PDF's owner password), renamed to pdfcrypt:

http://www.esnips.com/web/PDFTools?docsPage=3#files - pdfcrypt


Posted By: Ingo
Date Posted: 28 Feb 07 at 1:28AM
Hi Chicks!

This is the only one i've missed now in QuickPDF - Again thanks a lot!
What do you think: Should we offer your cmdtool here in the download-section?

Best regards,
Ingo



Posted By: chicks
Date Posted: 28 Feb 07 at 9:53AM
Probably better to post a link to it, since I may be updating it further.

Marco has already posted a link to it from his JNC site, in the "Done with JNC" section:

http://jnc.mtsystems.ch/more_info.html - Done with JNC

BTW, Marco is working on making the libs more granular, so should be able to reduce the size of the .exe soon.


Posted By: Ingo
Date Posted: 01 Mar 07 at 12:57AM
Hi Chicks!

Your news become better and better from day to day ;-)



Posted By: marian_pascalau
Date Posted: 01 Mar 07 at 2:56AM
Hi guys,
for your information it just happen to have to use encryption for one of my delphi projects. If you manage to cummulate a propper contribution I am willing to offer you this stuff in pure Delphi (with source code; just the AES Encryption).
 
For more info please contact me on support(at)quickpdf.org or quickpdf(at)gmx.net.
 
Best regards, Marian


Posted By: chicks
Date Posted: 06 Mar 07 at 11:50AM
An interesting commercial PDF encryption library, available as a VCL or .NET, supports digital signatures and encryption with certs:

http://www.eldos.com/sbb/desc-pdf-features.php - PDFBlackbox

Doesn't appear to support AES-128 encryption yet, but does have royalty-free licensing.


Posted By: Ingo
Date Posted: 06 Mar 07 at 2:29PM
Hi Chicks!

My favourite is still PDFtron ... but the best would be aes inside QuickPDF ;-)




Posted By: Ingo
Date Posted: 15 Mar 07 at 3:13PM
Hi Chicks and all other experts in this case!

The only thing that's not so good with pdfcrypt from JNC are the bytes. Now i've seen the opensource "ProGuard 3.8". It should be a compressor for java-files. Elimination of unused code parts and so on ... I've unzipped it but i can't do anything with it ;-)    Is it possible to shrink the pdfcrypt.jar/-exe with proguard?

Best regards,
Ingo



Posted By: chicks
Date Posted: 15 Mar 07 at 5:12PM
Ingo,

Nice try, but Marco would need to use it on the ClassPath GNU lib, which is so efficiently written that ProGuard can only achieve 4% total reduction on it (according to the ProGuard web site).

Doubt that Marco would be interested, as it might break something he already has working...

Marco is working on better aggregation of the required libs, so I should be able to shrink it with his next release of JNC.


Posted By: Ingo
Date Posted: 15 Mar 07 at 5:46PM
Thanks!
I'll wait ;-)

Best regards,
Ingo




Posted By: Michel_K17
Date Posted: 15 Mar 07 at 8:39PM
PDF Blackbox is $7,675.00 for the .NET version with permission to redistribute in compiled form as part of another product.

Ouch! Smile



-------------
Michel


Posted By: chicks
Date Posted: 28 Mar 07 at 1:57PM
Originally posted by Michel_K17 Michel_K17 wrote:

PDF Blackbox is $7,675.00 for the .NET version with permission to redistribute in compiled form as part of another product.Ouch! [IMG]smileys/smiley1.gif" align="absmiddle" alt="Smile" />


Hmmm, I'm probably doing this wrong, but I get $614 for a single-developer "Vendor" license for the VCL version of PDFBlackbox.

"Vendor license is offered to Independent Software Vendors (both individuals and companies), who develop and license their end-user software to third-parties. Vendor license corresponds to previously available Standard License."


Posted By: chicks
Date Posted: 10 May 07 at 5:11PM
Ingo,

It looks like you can use iTextSharp directly from Delphi, so long as it's .NET. Govert shows how here:

http://www.noliturbare.com/index.php - Govert's Tools

(click on iTextSharp in Delphi at the bottom left).

Govert has developed a couple of PDF tools in Delphi using iTextSharp.



Posted By: Ingo
Date Posted: 10 May 07 at 6:48PM
Hi!

Great... Seems i should have a closer look on it ;-)
Thanks!

Best regards,
Ingo


Posted By: oyster
Date Posted: 21 Jan 08 at 3:19AM
hi, chicks, do you have any indea to compile your encrypt_pdf under mingw+msys, since JNC is not free? Thanx
the following is what I got on my win2k
 
$ gcj encrypt_pdf.java --classpath=itext-1.4.8.jar
C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ccOAbaaa.o: In function `ZN11encrypt_pdf4mainEP6JArrayIPN4java4lang6StringEE':h:/pp/encrypt_pdf.java:67: undefined reference to `com::lowagie::text::pdf::PdfReader::class$':h:/pp/encrypt_pdf.java:67: undefined reference to `com::lowagie::text::pdf::PdfReader::PdfReader(java::lang::String*)':h:/pp/encrypt_pdf.java:76: undefined reference to `com::lowagie::text::pdf::PdfEncryptor::encrypt(com::lowagie::text::pdf::PdfReader*, java::io::OutputStream*, int, java::lang::String*, java::lang::String*, int, java::util::HashMap*)'h:/mingw/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.5/../../../libmingw32.a(main.o):main.c:(.text+0x106): undefined reference to mailto:`WinMain@16 - `WinMain@16'


Posted By: chicks
Date Posted: 21 Jan 08 at 11:52AM
I don't think it's possible under mingw/msys, which hasn't been updated in a while. The author of JNC put a lot of work into getting newer versions of gcj, gcc, etc. working on Windows. I have had some success with compiling other iText tools natively, using the source tree and build of pdftk 1.41 as the starting point.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk