That error means that your crypto provider doesn't have that algorithm. Use 
bouncycastle as the crypto provider and it will work. See 
http://www.bouncycastle.org/wiki/display/JA1/Provider+Installation.

Paulo

----- Original Message ----- 
From: "Hans Lund" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, May 11, 2007 8:17 AM
Subject: [iText-questions] pdf encryption


> I'm trying to use iText to encrypt documents using public keys and the
> PdfStamper
>
>
> This is what I have tried:
>
> Certificate[] certs = certificateStream == null ? null :
> 
> (Certificate[])CertificateFactory.getInstance("X.509").
>                       generateCertificates(certificateStream).
>                       toArray( new Certificate[]{} );
>
>
>                       PdfStamper stamp = new PdfStamper(new
> PdfReader(input), out);
>                   stamp.setEncryption(certs, permissions,1 );
>                   stamp.close();
>
>
> but the stamp.setEncryption call fails with the following:
> Exception in thread "main" ExceptionConverter:
> java.security.NoSuchAlgorithmException: 1.2.840.113549.3.2
> AlgorithmParameterGenerator not available
> at sun.security.jca.GetInstance.getInstance(GetInstance.java:158)
> at java.security.Security.getImpl(Security.java:691)
> at 
> java.security.AlgorithmParameterGenerator.getInstance(AlgorithmParameterGenerator.java:129)
> at 
> com.lowagie.text.pdf.PdfPublicKeySecurityHandler.createDERForRecipient(Unknown
> Source)
> at 
> com.lowagie.text.pdf.PdfPublicKeySecurityHandler.getEncodedRecipient(Unknown
> Source)
> at com.lowagie.text.pdf.PdfEncryption.getEncryptionDictionary(Unknown 
> Source)
> at com.lowagie.text.pdf.PdfWriter.setEncryption(Unknown Source)
> at com.lowagie.text.pdf.PdfStamper.setEncryption(Unknown Source)
> at 
> com.multisupport.util.security.Pdfencryptor.encryptPdf(Pdfencryptor.java:95)
> at com.multisupport.util.security.Pdfencryptor.main(Pdfencryptor.java:46)
>
>
>
> any hints ??
>
> Best Regards
> Hans Lund
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/ 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to