Why Hit "No Token Present" error even the USB token has been inserted?

Hi,
I am totally new to programming with cryptographic token.
When i try to login my secure token after inserted it into the USB port, my program throws "No Token Present" error.
I confirmed that the USB token is inserted properly because i can login the token with the Token Admin app installed on my system.
I have also installed the Provider successfully dynamically in my code.
Can anyone give me some idea or solution?
Thanks very much.
I program based on JDK 6 update 7 on Windows XP SP2 and the USB Secure Token (ST 2) is from SecureMetrics.
The error message is as shown as below:
Please kindly help to take a look at my code.
Use Provider: SunPKCS11-FeitianPKCS
Version: 1.600000
Info: SunPKCS11-FeitianPKCS using library D:\Develop\JavaPKCS11\ST2pkcs11v10.dll
Services: 0
{color:#999999}{color:#ff0000}javax.security.auth.login.LoginException: No token{color}{color}{color:#ff0000} present{color}{color:#ff0000}
{color}at sun.security.pkcs11.SunPKCS11.login(SunPKCS11.java:1044)
// Main code
String configName = "D:\\Develop\\JavaPKCS11\\pkcs11.cfg";
Provider p = new sun.security.pkcs11.SunPKCS11(configName);
Security.addProvider(p);
Provider[] ps = Security.getProviders();
System.out.printf("Total providers %d\n\n", ps.length);
for (int i=0; i<ps.length;i++) {
System.out.printf("Provider[%d]: %s\n",i, ps.getName());
//Create the provider we defined
Provider p = Security.getProvider("SunPKCS11-FeitianPKCS");
System.out.printf("\nUse Provider: %s\n", p.getName());
System.out.printf("Version: %f\n", p.getVersion());
System.out.printf("Info: %s\n", p.getInfo());
//List all the services it supports
System.out.printf("Services: %d\n", p.getServices().size());
Set ss = p.getServices();
Iterator ii = ss.iterator();
Service s;
while (ii.hasNext()) {
s = (Service) ii.next();
System.out.printf("Service: %s - %s - %s \n", s.getType(), s.getAlgorithm(), s.getClassName());
try {
MyGuiCallbackHandler mcb = new MyGuiCallbackHandler();
Subject token = new Subject();
AuthProvider aprov = (AuthProvider) p;
//Login the token
aprov.login(token, mcb);
Config:
name = FeitianPKCS#11
library = D:\Develop\JavaPKCS11\ST2pkcs11v10.dll

Hi Martin,
Thanks very much for your kind help and sharing of experience.
Below is my complete code and also the exceptions that i get.
Program output + exceptions
Java PKCS#11 Demo
Load library success
Total providers: 10
Provider[0]: SUN
Provider[1]: SunRsaSign
Provider[2]: SunJSSE
Provider[3]: SunJCE
Provider[4]: SunJGSS
Provider[5]: SunSASL
Provider[6]: XMLDSig
Provider[7]: SunPCSC
Provider[8]: SunMSCAPI
Provider[9]: SunPKCS11-FeitianPKCS
Use Provider: SunPKCS11-FeitianPKCS
Version: 1.6
Info: SunPKCS11-FeitianPKCS using library D:\\Develop\\JavaPKCS11\\ngp11v211.dll
javax.security.auth.login.LoginException: No token present
    at sun.security.pkcs11.SunPKCS11.login(SunPKCS11.java:1044)
    at javapkcs11.Main.main(Main.java:112)Main.java
// Main.java
package javapkcs11;
import java.security.*;
import java.security.Provider.*;
import javax.security.auth.*;
import java.util.*;
import java.lang.*;
import javax.crypto.*;
import javax.crypto.spec.*;
//import sun.misc.*;
* @author
public class Main {
    /** Creates a new instance of Main */
    public Main() {     
     * @param args the command line arguments
    public static void main(String[] args) {
        System.out.println("Java PKCS#11 Demo\n\n");
        //Load the configuration file       
        if (Main.configProvider())
            System.out.println("Load library success\n\n");
        else {
            System.out.println("Load library failed\n\n");
            return;
        //List all the providers
        Provider[] ps = Security.getProviders();
        System.out.println("Total providers: " + ps.length);
        for (int i=0; i<ps.length;i++) {
          //  System.out.printf("Provider[%d]: %s\n",i, ps.getName());
System.out.println("Provider[" + i + "]: " + ps[i].getName());
//Create the provider we defined
Provider p = Security.getProvider("SunPKCS11-FeitianPKCS");
//System.out.printf("\nUse Provider: %s\n", p.getName());
System.out.println("\nUse Provider: " + p.getName() );
//System.out.printf("Version: %f\n", p.getVersion());
System.out.println("Version: " + p.getVersion() );
//System.out.printf("Info: %s\n", p.getInfo());
System.out.println("Info: " + p.getInfo() );
//List all the services it supports
//System.out.printf("Services: %d\n", p.getServices().size());
Set ss = p.getServices();
Iterator ii = ss.iterator();
Service s;
while (ii.hasNext()) {
s = (Service) ii.next();
// System.out.printf("Service: %s - %s - %s \n", s.getType(), s.getAlgorithm(), s.getClassName());
System.out.println("Service: " + s.getType() + " " + s.getAlgorithm() + " " + s.getClassName());
try {
     char pin[] = "99999999".toCharArray();
MyGuiCallbackHandler mcb = new MyGuiCallbackHandler();
Subject token = new Subject();
AuthProvider aprov = (AuthProvider) p;
//Login the token
aprov.login(token, mcb);
} catch (Exception e) {
e.printStackTrace();
public static boolean configProvider() {
//Here defines the path of configuration file, you could change it
String configName = "D:\\Develop\\JavaPKCS11\\pkcs11.cfg";
try {
Provider p = new sun.security.pkcs11.SunPKCS11(configName);
Security.addProvider(p);
} catch (Exception e) {
e.printStackTrace();
return false;
return true;
}PKCS11 Configname = FeitianPKCS
library = D:\\Develop\\JavaPKCS11\\ngp11v211.dll
slot = 3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • IPod Nano: Error Message "The USB device has malfunctioned and Windows does not recognise it"

    Hi everyone, I just received 2 brand new iPod Nanos for my kids for Christmas, thought I'd be smart and sync them both now before wrapping them so I don't have to be messing around with them on the day. One synced without a problem, then using the same cable, same computer, same USB port, the 2nd one came up with "The USB device has malfunctioned and Windows does not recognise it" I've tried restarting my computer, unplugging and reinserting the USB. Is there anthing else I can try before returning it? Thanking you for any help.

    I have solved my problem, I ended up ringing Apple and got an awesome lady who told me to reset it by pressing the sleep button and menu button together for about 10 seconds and once it actually turned on for the first time the computer then recognised it, so it's all good, :-) Thank you lovely lady!

  • Connection error appears: "the internet connection has been closed because it cannot be analyzed", then if refreshed: "ssl_error_rx_record_too_long".

    This is only happening on one computer in the house (the other computer and laptop access internet just fine). I can not access any websites.
    In about:config nothing appears in the "security.enable" search
    Proxy is set to "no proxy"
    I am using avast antivirus (a detailed scan showed no viruses" I also did an AdwClearner, which did not help either.
    THANK YOU for your help, this is really frustrating!

    See:
    * http://kb.mozillazine.org/security.tls.version.*
    0 means SSL 3.0, 1 means TLS 1.0, 2 means TLS 1.1, 3 means TLS 1.2 etc.

  • Why does itunes give an error saying " The Iphone cannot be synced. An unknown error occured (-50). Everytime I try to sync my phone?

    Why does itunes give an error saying " The Iphone cannot be synced. An unknown error occured (-50)". Everytime I try to sync my phone? I have another Iphone that syncs with the same itunes account and it's working fine.

    What operating system do you have on your computer?

  • Error message: ni: A frame has been dropped and the acqusition has been canceled

    I use a NI PCIe 1433 framegrabber with a Basler spl4096-140km line camera.
    Using triggered acqusition with an external source, I can get a framerate of 68500Hz in NI-MAX.
    When I use the Matlab image acquisiton toolbox to acquire data, I however very often get the error message: 'ni: A frame has been dropped and the acqusition has been canceled". This happens even at much lower framerates (20kHz) and only seems to go away when acquiring data slowly.
    Computer is a Dell Precision 7600 and I assume there should be no issues with RAM or the PC being slow. The error does not go away when reducing the data size (i.e. reducing the ROI to one single point that is readout).
    Do you have any pointers why this error message appears and what can be done about it?
    Thank you!
    Reto

    Hello,
    I encountered the same problem and I think it is because the allowcation of storage in matlab cannot catch up with that of the camera so that it will drop frames when the buffer is full.
    I also want to know how to solve that.
    Yang

  • Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --- System.NullReferenceException: Object reference not set to an instance of an object

    Hi,
    (1) I am trying to get the data from a database table and import into a text file.
    (2) If the record set have the data then it runs ok
    (3) when the record set not having any data it is giving the below error
    Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
    Could you please let me know why this is happening?
    Any help would be appriciated
    Thanks,
    SIV

    You might ask them over here.
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral%2Ccsharpgeneral%2Cvcgeneral&filter=alltypes&sort=lastpostdesc
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • I have an iPod 5th gen. My audiobook playlists disappeared. They show as "on this device" in iTunes, but I cannot locate them on the device. Even the audiobook tab has disappeared. This happed after the most recent iTunes udate.

    I have an iPod 5th gen. My audiobook playlists disappeared. They show as "on this device" in iTunes, but I cannot locate them on the device. Even the audiobook tab has disappeared. This happed after the most recent iTunes update.

    - Delete all AB and resync
    To delete all music go to Settings>General>Usage>Storage>Manage Storage>Audio Book (if present) and delete
    - Reset all settings                            
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                               
    iOS: Back up and restore your iOS device with iCloud or iTunes      
      - Restore to factory settings/new iOS device.                       

  • Error 'connection to the storage medium has been i...

    my phone is 5235
    heres my problem i formated my phone and mem card.so my map data was gone......i downloaded map loader installed it....i run it connect my phone to usb....it starts downloading at 98.3% it goes to saving on storage device--at about 21% it says--
    'connection to the storage medium has been interrupted, attach your storage medium and retry'.
    even though i havent touched a thing...it has happenend twice
    if u see this link
    /t5/PC-and-Mac-Software/nokia-map-loader-error/m-p/141475
     ,u will see that i am not the only one with this problem ..please help

    Me too facing this problem while download map onto my devices ..can someone help us??event i'm replace my memory into card reader still got this problem...

  • After answering the three security questions on itunes connect the submit button is still grayed out. It looks like it could be an error on the website. Has anyone encountered this issue?

    After answering the three security questions to update an app on itunes connect the submit button is grayed out. It looks like an error on the website. Has anyone ran into this problem before? Any help would be greatly appreciated.

    Hi evanVIT, 
    Welcome to the Apple Support Communities!
    I understand that issues like the one you are experiencing can be very frustrating. For this situation however, for update errors in the range of 3000-3020, I would recommend the troubleshooting steps located in the attached article. Please use the steps and information as a reference. 
    Error 3194, Error 17, or "This device isn't eligible for the requested build"
    Cheers, 
    Joe

  • I'm getting the error message "Photos folder syncing has been disabled for the iPhone my iPhone because the folder "Pictures" cannot be found."

    I'm getting the error message "Photos folder syncing has been disabled for the iPhone <my iPhone> because the folder "Pictures" cannot be found." lately.
    Normally, all I do with photos is move them from my iPhone to my computer's (Windows 7) hard drive. I do this by connecting the iPhone with the cable, a box pops up on the screen asking me what I want to do, and I choose "Import pictures and videos". I've previously selected the "delete photos from the device after move" option (or however it's worded...), simply because I don't want this device to fill up with photos.
    Lately, it has been importing the photos fine, but it won't delete them from the iPhone. This used to work just fine, now it doesn't work and I don't know what changed, if anything. In iTunes, I get the error message I list at the beginning of this message.
    How do I fix this?

    Hi there scarbo59,
    You mentioned that you are still able to import without issues, but you may still want to run through the troubleshooting steps outlined in the article below. 
    iOS: Unable to import photos to computer
    -Griff W. 

  • ITunes is updated and works fine and I am able to log onto my account. When I go to purchase a song, I get the error message "Your Apple ID has been disabled". I've tried different methods: changing passwords, making a new account with another email addre

    iTunes is updated and works fine and I am able to log onto my account. When I go to purchase a song, I get the error message "Your Apple ID has been disabled". I've tried different methods: changing passwords, making a new account with another email address, and emailing itunes tech support. I am curious as to how many others have been experiencing the same issue. When I googled the error, it seemed like it was happening extremely often with many people.
    We all love their products, but they always come with a lot of issues and horrible customer support.
    My apple Id is [email protected]

    My Iphone 4 is telling me the same thing and I believe I figured out what the problem is.  I had some fraudulent charges on my itunes account, so I call my bank and disputed the charges.  Right after I did that, I started getting the message "Your apple ID has been disabled."  I just realized today that the charges are not fraudulent, they are "in app purchases."  One of my daughters downloaded the game Top Girl which is FREE, but in the game Top Girl you use money in the game to purchase things.  It just so happens that the money you use to purchase things is real money MY Money!!!.  My daughter thought she was using play money in the game and had no idea she was using real money.  She spent $106.00 buying stuff.  Now I have to call the bank and tell them to release the hold and pay Itunes.  I'm hoping this solves the problem.  Here is the link to learn how to disable "in app purchase" on your iphone or ipad.
    http://www.ikidapps.com/2010/12/parents-avoid-accidental-app-purchases-how-to-tu rn-off-in-app-purchasing.html

  • TS2446 I have an error message "Your apple ID has been disabled".  I have reset the password and it does not fix the problem.   What can I do.

    I keep getting an error message "Your apple ID has been disabled"   I have reset the password, but still cannot update or purchase any apps.  What can I do??

    Contact iTunes.
    http://www.apple.com/support/itunes/contact/

  • Getting the error message"your apple ID has been disabled" . I reset my ID password last night and am still having the same issue.

    getting the error message"your apple ID has been disabled" . I reset my ID password last night and am still having the same issue.

    If you are still unable to access your account after resetting your password, you will need to contact iTunes Store Customer Support via http://www.apple.com/support/itunes/contact/

  • Error message says "an ipod has been detected but it could not be identified.  We've disconnected the ipod and reconnected it but it hasn't worked.

    error message says "an ipod has been detected but it could not be identified.  We've disconnected the ipod and reconnected it but it hasn't worked.

    If the iPod was originally formated to your computer, restart your computer.  If not - How to use your iPod to move your music to a new computer

  • Getting an error prompt "the facebook server has returned an unknown error and is not able to fulfill your request. (2001)"

    Hi. I need help regarding facebook for blackberry. I cannot post any status update, i keep on receiving an error prompt "the facebook server has returned an unknown error and is not able to fulfill your request. (2001)".  it has been like this for the past 3 days. I already did the hard reboot many times, re-send service book though i do'nt think it's needed, and tried uninstalling and reinstalling the facebook application too but still getting the same error everytime i try to post a status update. I can comment to messages on my wall and other profiles, the news feed is updating in time too, i can also log-in and out to facebook with no problem, as well as other applications on my phone like foursquare, BBm, ubersocial, BB protect, BB app world, etc, are all working perfectly fine. And now I don't know what seems to be the problem.
    I've already contacted my network provider and told me that the error i'm getting is beyond their scope.
    Is anybody having the same problem as mine? 
    Can someone in BB support team help me regarding this issue and tell me what should I do?
    Thank you in advance. 

    I got the same issue !! Since I've updated my Facebook app 2 or 3 week ago !
    I can not  update my status and check-in ! It gives me "the facebook server has returned an unknown error and is not able to fulfill your request. (2001) "
    I can upload photo, put comment on people, like people status/picture. The news feed update perfectly !
    I also  tryied to uninstall reinstall the app, reboot etc etc ! I still can't update my status !!!! I've installed 3.0.0.17 this morning and the issue is still there...
    I've remarked one thing... On my facebook under "privacy setting/the Apps, Games and Websites" I used to have a "blackberry app" installed. It's not there anymore and I didn't remove it.
    I don't know how to reinstall it...

Maybe you are looking for

  • Unable to access network shares

    In our enterprise environment we have a home share with approx 20 folders viewable to all staff with different folder accessible to different departments. One of our users has an issue when switching from a wired to wireless network connection on his

  • Picture on TV appears black & white

    I have successfully connected my Toshiba laptop to my TV using the TV out (S-Video) connection to SCART. I have now purchased a new TV which is HD LCD but upon connection the screen is black & white. I have searched everywhere and tried any possible

  • Photoshop CS6 not opening files from Lightroom 5.6

    On my mac I updated to Lightroom 5.6. Now it will not open the file in Photoshop CS6 using the "Edit it Photoshop" option. Anyone know how to work around this? I do not want to "render in lightroom" each time. Thanks!

  • Month end closing - production order status

    Hello, I am requesting the information, can I  carry  the month end closing and account for only production orders having the TECO system status rather than considering production orders with the DLV status. Where in SPRO these parameters are being a

  • Paste in front or similar

    Hi, all; Sometimes when I copy and paste an object in Captivate, it has the exact position as the original.  Other times, it is offset by a few pixels down and to the right.  I'd like to be able to control this, rather than having it be random--usual