On 27/02/2012 1:03, Andrew Lawrence (Stratton Finance) wrote:
> Hi,
> I am trying to secure a pdf using AES 128-bit. However when I check the
> security settings on the PDF they always say that RC4 128-bit is being used.
>
> Here is the code that I am using to secure the pdf:
>
> using (Stream input = new FileStream(pdfFilename, FileMode.Open))
> using (Stream output = new FileStream(outputPdfFilename, FileMode.CreateNew))
> {
> var reader = new PdfReader(input);
> const int permissions = PdfWriter.ALLOW_SCREENREADERS
> | PdfWriter.ALLOW_PRINTING
> | PdfWriter.DO_NOT_ENCRYPT_METADATA
> | PdfWriter.ENCRYPTION_AES_128;
> PdfEncryptor.Encrypt(reader, output, true, null, ownerPassword,
> permissions);
> }
>
> I am using iTextSharp 5.1.0.
> I am checking the security settings using Adobe Acrobat.
> Any help would be appreciated.
You're not using the correct syntax to set the encryption to AES 128.
Nor PdfWriter.ENCRYPTION_AES_128, nor PdfWriter.DO_NOT_ENCRYPT_METADATA
should be defined as 'persmissions'. These are values you should use for
another parameter (see pages 387-390 of "iText in Action - Second Edition").
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php