Op 11/01/2013 12:12, Marot Laurent schreef:
> 134:                String alias = (String)ks.aliases().nextElement();

> Exception in thread "main" java.util.NoSuchElementException

Looks as if nothing can be found in the slot. Are you using the correct slot?
What makes you think the slot with index 0 is the correct one:
getSlotsWithTokens(DLL)[0]



I wonder indeed about slot#. So I've made different tests (getSlotsWithTokens 
method confirms I've got 2 slots ok)

An here are below the weird results :

idslot = 0
Exception in thread "main" java.security.ProviderException: Initialization 
failed
        at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:374)
        at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:107)
        at 
com.alliacom.crypto.luna.SignWithPKCS11HSM.main(SignWithPKCS11HSM.java:121)
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_SLOT_ID_INVALID     
        =========> ok I understand first id is 1
        at sun.security.pkcs11.wrapper.PKCS11.C_GetSlotInfo(Native Method)
        at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:363)
        ... 2 more


idslot = 1
Exception in thread "main" java.util.NoSuchElementException
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:809)
        at java.util.HashMap$KeyIterator.next(HashMap.java:841)
        at java.util.Collections$2.nextElement(Collections.java:3657)
        at 
com.alliacom.crypto.luna.SignWithPKCS11HSM.main(SignWithPKCS11HSM.java:133)


idslot = 2
Exception in thread "main" java.io.IOException: load failed
        at sun.security.pkcs11.P11KeyStore.engineLoad(P11KeyStore.java:774)
        at java.security.KeyStore.load(KeyStore.java:1214)
        at 
com.alliacom.crypto.luna.SignWithPKCS11HSM.main(SignWithPKCS11HSM.java:131)
Caused by: javax.security.auth.login.LoginException
        at sun.security.pkcs11.SunPKCS11.login(SunPKCS11.java:1177)
        at sun.security.pkcs11.P11KeyStore.login(P11KeyStore.java:874)
        at sun.security.pkcs11.P11KeyStore.engineLoad(P11KeyStore.java:764)
        ... 2 more
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_DEVICE_ERROR
        at sun.security.pkcs11.wrapper.PKCS11.C_Login(Native Method)
        at sun.security.pkcs11.SunPKCS11.login(SunPKCS11.java:1161)
        ... 4 more

idslot = 3
Exception in thread "main" java.security.ProviderException: Initialization 
failed
        at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:374)
        at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:107)
        at 
com.alliacom.crypto.luna.SignWithPKCS11HSM.main(SignWithPKCS11HSM.java:121)
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_SLOT_ID_INVALID
        at sun.security.pkcs11.wrapper.PKCS11.C_GetSlotInfo(Native Method)
        at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:363)
        ... 2 more
Java Result: 1



________________________________

Le papier est un support de communication naturel, renouvelable et recyclable. 
Si vous devez imprimer ce mail, n’oubliez pas de le recycler.
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
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

Reply via email to