Difference between revisions of "JSS CryptoToken"

From Dogtag
Jump to: navigation, search
m (Finding a Token)
m (Replaced content with "This page has been moved to https://github.com/dogtagpki/jss/wiki/CryptoToken.")
 
Line 1: Line 1:
= Getting All Tokens =
+
This page has been moved to https://github.com/dogtagpki/jss/wiki/CryptoToken.
 
 
<pre>
 
CryptoManager manager = CryptoManager.getInstance();
 
Enumeration<CryptoToken> tokens = manager.getAllTokens();
 
 
 
whlie (tokens.hasMoreElements()) {
 
    CryptoToken token = tokens.nextElement();
 
    ...
 
}
 
</pre>
 
 
 
= Getting a Token =
 
 
 
<pre>
 
CryptoManager manager = CryptoManager.getInstance();
 
 
 
CryptoToken token;
 
 
 
if (...) {
 
    token = manager.getInternalKeyStorageToken();
 
} else {
 
    token = manager.getTokenByName(tokenName);
 
}
 
 
 
manager.setThreadToken(token);
 
</pre>
 
 
 
= Authentication =
 
 
 
To authenticate with PasswordCallback:
 
 
 
<pre>
 
public interface PasswordCallback {
 
    public Password getPasswordFirstAttempt(PasswordCallbackInfo info) throws GiveUpException;
 
    public Password getPasswordAgain(PasswordCallbackInfo info) throws GiveUpException;
 
}
 
</pre>
 
 
 
<pre>
 
PasswordCallback pc = ...;
 
manager.setPasswordCallback(pc);
 
</pre>
 
 
 
To authenticate with password:
 
 
 
<pre>
 
Password password = new Password(chars);
 
token.login(password);
 
password.clear();
 
</pre>
 
 
 
= References =
 
 
 
* [[JSS API]]
 

Latest revision as of 18:04, 29 July 2022

This page has been moved to https://github.com/dogtagpki/jss/wiki/CryptoToken.