CryptoToken - dogtagpki/jss GitHub Wiki
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();