Validate when keystore.load() is canceled
Asked Answered
B

0

3

I need to write an applet that reads info from smartcards, I based my script on the code example provided by @Jovo Krneta here.

My concern is about this specific piece of code:

keyStore.load(null, null); // opens the windows security window
Enumeration<String> enums = keyStore.aliases(); // looks for local certificates

while (enums.hasMoreElements()) {
    this.jComboBox1.addItem((String) enums.nextElement());
}

I'm finding it hard to find a way to validate if the user clicked on Cancel once the window is opened.

enter image description here

My question is if exists something like

keyStore.load(null, null);
if(keyStore.canceled()){
   // do nothing
}else{
    Enumeration<String> enums = keyStore.aliases(); // looks for local certificates 
    while (enums.hasMoreElements()) {
        this.jComboBox1.addItem((String) enums.nextElement());
    }
}
Boozy answered 27/2, 2014 at 16:24 Comment(1)
Even though you don't have an answer to your question, your question helped me with an issue that I've been trying to solve for a few weeks! Thanks! (Specifically, the keyStore.load() method that you use.) Just a question, do you know how that pop up appears? I've never been able to get anything like it with all the other ways I've tried, even your code here.Reluctance

© 2022 - 2024 — McMap. All rights reserved.