Hello,

Ok I understand you. I test SpongyCastle but the problem is the same so ...
I download the suggested trial version of itextgoogle-5.4.0.jar and the same
error.

I install itextgoogle-5.4.0.jar package, I load the license file
itextkey.xml and I have the same error. Do I need to use spongy castle? I
understand with your answer, that  if I use itextgoogle-5.4.0.jar, I don't
need any extra jar file. Is this correct? Exist a sample of using
itextgoogle-5.4.0.jar?

Best regards

Flash Team
 
-----Mensaje original-----
De: Michael Demey [mailto:michael.de...@itextpdf.com] 
Enviado el: lunes, 25 de febrero de 2013 10:23
Para: Post all your questions about iText here
Asunto: Re: [iText-questions] Protect the PDF with digital signature in
Android sample

Hi,


First of all, Android uses a custom version of bouncycastle, so by adding
bouncycastle to your application, you are most likely to run into problems.
That's why SpongyCastle exists.

Secondly, iText has an Android port which has dependencies on the right
libraries (spongycastle vs bouncycastle) and includes changes to its api
concerning Java interfaces that aren't included in Android Java.

You can request a trial version of the Android port here:
http://demo.itextsupport.com/newslicense/

Kind regards,
Michaël.



Op 24/02/2013 22:03, flash.t...@gmail.com schreef:
> Hello all,
>
> I see in Chapter 12 “Protecting your PDF” the sample who shows how to 
> protect the PDF. As I see, it’s a Java sample but not for Android (or 
> nor working for me ;)).
>
> I try to create an Android Activity who protects the PDF with a 
> digital signature but the result is always an exception. My piece of code
is:
>
> ----------------------------------------------------------------------
> ---------------
>
> Document document = *new*Document();
>
> file = externalStoragePath + File./separator/+ FILE;
>
> PdfWriter writer =
> PdfWriter./getInstance/(document,*new*FileOutputStream(file));
>
> Certificate cert = getPublicCertificate("my_own_certificate.cer"); // 
> generated with keytool
>
> writer.setEncryption(*new*Certificate[] {cert}, *new**int*[] 
> {PdfWriter./ALLOW_PRINTING/} , PdfWriter./ENCRYPTION_AES_128/| 
> PdfWriter./DO_NOT_ENCRYPT_METADATA/);
>
> writer.createXmpMetadata();
>
> document.open();
>
> addMetaData(document);
>
> addTitlePage(document);
>
> addContent(document);
>
> document.close();
>
> ----------------------------------------------------------------------
> ----------------
>
> where getPublicCertificate function is:
>
> *public*Certificate getPublicCertificate(String filename)
>
> *throws*IOException, CertificateException {
>
>               InputStream is =
> MyApplication./getAppContext/().getAssets().open(filename);
>
>               CertificateFactory cf =
> CertificateFactory./getInstance/("X.509", 
> *new*BouncyCastleProvider());
>
>               X509Certificate cert =
> (X509Certificate)cf.generateCertificate(is);
>
> *return*cert;
>
>         }
>
> The Exception is raised in writer.setEncryption function and is:
>
> java.security.NoSuchAlgorithmException: AlgorithmParameterGenerator
> 1.2.840.113549.3.2 implementation not found
>
> I’m using Android 4.2, itextpdf-5.4.0.jar, bcprov-jdk15on-148.jar, 
> bcpkix-jdk15on-148.jar, bcpg-jdk15on-148.jar, bcmail-jdk15on-148.jar.
>
> Please, any suggestion or sample.
>
> Thanks in advance
>
> Flash Team
>
>
>
> ----------------------------------------------------------------------
> -------- Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics Download AppDynamics Lite 
> for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
>
>
>
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> 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
>


----------------------------------------------------------------------------
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics Download AppDynamics Lite for
free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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

Reply via email to