-
Notifications
You must be signed in to change notification settings - Fork 31
CryptoToken
Endi S. Dewata edited this page Oct 21, 2025
·
2 revisions
CryptoManager manager = CryptoManager.getInstance();
Enumeration<CryptoToken> tokens = manager.getAllTokens();
whlie (tokens.hasMoreElements()) {
CryptoToken token = tokens.nextElement();
...
}
CryptoManager manager = CryptoManager.getInstance();
CryptoToken token;
if (...) {
token = manager.getInternalKeyStorageToken();
} else {
token = manager.getTokenByName(tokenName);
}
manager.setThreadToken(token);
To authenticate with PasswordCallback:
public interface PasswordCallback {
public Password getPasswordFirstAttempt(PasswordCallbackInfo info) throws GiveUpException;
public Password getPasswordAgain(PasswordCallbackInfo info) throws GiveUpException;
}
PasswordCallback pc = ...; manager.setPasswordCallback(pc);
To authenticate with password:
Password password = new Password(chars); token.login(password); password.clear();
See also PKCS #11 Authentication API.