Hello, Running following code I get the error shown below :
Note that I've defined two ks because as output can make you see, I can't get any objet with PKCS11 ks (weird, isn't it ? But not my current problem and maybe quite off topic but if you have input on that part do not hesitate to contact me in private mail) CODE : Properties properties = new Properties(); try { properties.load(new FileInputStream(PROPS)); char[] pass = properties.getProperty("PASSWORD").toCharArray(); String pkcs11cfg = properties.getProperty("PKCS11CFG"); BouncyCastleProvider providerBC = new BouncyCastleProvider(); Security.addProvider(providerBC); FileInputStream fis = new FileInputStream(pkcs11cfg); Provider providerPKCS11 = new SunPKCS11(fis); Security.addProvider(providerPKCS11); KeyStore ks = KeyStore.getInstance("PKCS11"); ks.load(null, pass); KeyStore Lunaks = KeyStore.getInstance("Luna"); Lunaks.load(null, null); showProps(ks); showProps(Lunaks); String alias = (String)Lunaks.aliases().nextElement(); LunaKey PrivateKey = null, PublicKey = null; PublicKey = new LunaKey(); PublicKey = PublicKey.LocateKeyByAlias("Public TestKey LM"); System.out.println("\t-Public key was stored on - " + PublicKey.GetDateMadePersistent()); PrivateKey = new LunaKey(); PrivateKey = PrivateKey.LocateKeyByAlias("Private TestKey LM"); System.out.println("\t-Private key was stored on - " + PrivateKey.GetDateMadePersistent()); PrivateKey pk = (PrivateKey)PrivateKey; Certificate[] chain = Lunaks.getCertificateChain("Certificate Test LM"); OcspClient ocspClient = new OcspClientBouncyCastle(); TSAClient tsaClient = null; for (int i = 0; i < chain.length; i++) { X509Certificate cert = (X509Certificate)chain[i]; String tsaUrl = CertificateUtil.getTSAURL(cert); if (tsaUrl != null) { tsaClient = new TSAClientBouncyCastle(tsaUrl); break; } }; List<CrlClient> crlList = new ArrayList<CrlClient>(); crlList.add(new CrlClientOnline(chain)); OUTPUT : Keystore Information Provider - SunPKCS11-LunaSA version 1.6 Type - PKCS11 Size - 0 objects Keystore Information Provider - LunaJCAProvider version 1.0 Type - Luna Size - 4 objects -Public key was stored on - Wed Jan 23 17:32:48 CET 2013 -Private key was stored on - Wed Jan 23 17:32:48 CET 2013 Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/cert/ocsp/BasicOCSPResp at com.alliacom.crypto.luna.SignWithLuna.main(SignWithLuna.java:99) Caused by: java.lang.ClassNotFoundException: org.bouncycastle.cert.ocsp.BasicOCSPResp at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) I'm using jdk1.5on-147 bouncy castle lib and I actually can't see org/bouncycastle/cert/ocsp/BasicOCSPResp but org.bouncycastle.ocsp.BasicOCSPResp Laurent Marot ________________________________ Le papier est un support de communication naturel, renouvelable et recyclable. Si vous devez imprimer ce mail, n’oubliez pas de le recycler. ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ 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