-
Notifications
You must be signed in to change notification settings - Fork 30
CryptoToken
Endi S. Dewata edited this page Jul 29, 2022
·
1 revision
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();