|
JSS 3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mozilla.jss.pkcs11.PK11Token
A PKCS #11 token. Currently, these can only be obtained from the CryptoManager class.
CryptoManager
Inner Class Summary | |
static interface |
PK11Token.NotInitializedException
Thrown if the operation requires that the token be logged in, and it isn't. |
Field Summary | |
protected PK11Store |
cryptoStore
|
protected boolean |
mIsInternalCryptoToken
|
protected boolean |
mIsInternalKeyStorageToken
|
protected TokenProxy |
tokenProxy
|
Constructor Summary | |
protected |
PK11Token()
|
protected |
PK11Token(byte[] pointer,
boolean internal,
boolean keyStorage)
Creates a new PK11Token. |
Method Summary | |
protected void |
changePassword(byte[] oldPIN,
byte[] newPIN)
Change the password on the token from the old one to the new one. |
void |
changePassword(PasswordCallback oldPINcb,
PasswordCallback newPINcb)
Change password. |
SymmetricKey |
cloneKey(SymmetricKey key)
Allows a SymmetricKey to be cloned on a different token. |
boolean |
doesAlgorithm(Algorithm alg)
Determines whether this token is capable of performing the given algorithm. |
boolean |
equals(java.lang.Object obj)
Deep-comparison operator. |
java.lang.String |
generateCertRequest(java.lang.String subject,
int keysize,
java.lang.String keyType,
byte[] P,
byte[] Q,
byte[] G)
Generates a PKCS#10 certificate request including Begin/End brackets |
protected java.lang.String |
generatePK10(java.lang.String subject,
int keysize,
java.lang.String keyType,
byte[] P,
byte[] Q,
byte[] G)
|
Cipher |
getCipherContext(EncryptionAlgorithm algorithm)
|
CryptoStore |
getCryptoStore()
|
JSSMessageDigest |
getDigestContext(DigestAlgorithm algorithm)
|
KeyGenerator |
getKeyGenerator(KeyGenAlgorithm algorithm)
|
KeyPairGenerator |
getKeyPairGenerator(KeyPairAlgorithm algorithm)
|
KeyWrapper |
getKeyWrapper(KeyWrapAlgorithm algorithm)
|
int |
getLoginMode()
|
int |
getLoginTimeoutMinutes()
|
java.lang.String |
getName()
|
java.security.Provider |
getProvider()
|
(package private) TokenProxy |
getProxy()
|
java.security.SecureRandom |
getRandomGenerator()
|
Signature |
getSignatureContext(SignatureAlgorithm algorithm)
|
protected void |
initPassword(byte[] ssopw,
byte[] userpw)
|
void |
initPassword(PasswordCallback ssopwcb,
PasswordCallback userpwcb)
Initialize PIN. |
boolean |
isInternalCryptoToken()
|
boolean |
isInternalKeyStorageToken()
|
boolean |
isLoggedIn()
|
boolean |
isPresent()
Determines if the given token is present on the system. |
boolean |
isWritable()
|
void |
login(PasswordCallback callback)
Log into the token. |
void |
logout()
Log out of the token. |
protected PasswordCallbackInfo |
makePWCBInfo()
|
protected void |
nativeLogin(PasswordCallback callback)
|
boolean |
passwordIsInitialized()
Determine whether the token has been initialized yet. |
protected boolean |
PWInitable()
Make sure the PIN can be initialized. |
void |
setLoginMode(int mode)
|
void |
setLoginTimeoutMinutes(int timeoutMinutes)
|
protected boolean |
SSOPasswordIsCorrect(byte[] ssopw)
|
protected boolean |
userPasswordIsCorrect(byte[] pw)
Check the given password, return true if it's right, false if it's wrong. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected boolean mIsInternalCryptoToken
protected boolean mIsInternalKeyStorageToken
protected TokenProxy tokenProxy
protected PK11Store cryptoStore
Constructor Detail |
protected PK11Token()
protected PK11Token(byte[] pointer, boolean internal, boolean keyStorage)
pointer
- A byte array containing a pointer to a PKCS #11 slot.Method Detail |
public Signature getSignatureContext(SignatureAlgorithm algorithm) throws java.security.NoSuchAlgorithmException, TokenException
public JSSMessageDigest getDigestContext(DigestAlgorithm algorithm) throws java.security.NoSuchAlgorithmException, java.security.DigestException
public Cipher getCipherContext(EncryptionAlgorithm algorithm) throws java.security.NoSuchAlgorithmException, TokenException
public KeyGenerator getKeyGenerator(KeyGenAlgorithm algorithm) throws java.security.NoSuchAlgorithmException, TokenException
public SymmetricKey cloneKey(SymmetricKey key) throws SymmetricKey.NotExtractableException, java.security.InvalidKeyException, TokenException
public KeyWrapper getKeyWrapper(KeyWrapAlgorithm algorithm) throws java.security.NoSuchAlgorithmException, TokenException
public java.security.SecureRandom getRandomGenerator() throws NotImplementedException, TokenException
public KeyPairGenerator getKeyPairGenerator(KeyPairAlgorithm algorithm) throws java.security.NoSuchAlgorithmException, TokenException
public boolean isLoggedIn() throws TokenException
public void login(PasswordCallback callback) throws PK11Token.NotInitializedException, IncorrectPasswordException, TokenException
callback
- A callback to use to obtain the password, or a
Password object.protected void nativeLogin(PasswordCallback callback) throws PK11Token.NotInitializedException, IncorrectPasswordException, TokenException
public boolean isWritable()
public boolean isPresent()
public void logout() throws TokenException
public int getLoginMode() throws TokenException
public void setLoginMode(int mode) throws TokenException
public int getLoginTimeoutMinutes() throws TokenException
public void setLoginTimeoutMinutes(int timeoutMinutes) throws TokenException
public void initPassword(PasswordCallback ssopwcb, PasswordCallback userpwcb) throws IncorrectPasswordException, AlreadyInitializedException, TokenException
ssopw
- The security officer's current password.userpw
- The user's new password.protected boolean PWInitable() throws TokenException
protected boolean SSOPasswordIsCorrect(byte[] ssopw) throws TokenException, AlreadyInitializedException
protected void initPassword(byte[] ssopw, byte[] userpw) throws IncorrectPasswordException, AlreadyInitializedException, TokenException
public boolean passwordIsInitialized() throws TokenException
public void changePassword(PasswordCallback oldPINcb, PasswordCallback newPINcb) throws IncorrectPasswordException, TokenException
oldPIN
- The user's old PIN.newPIN
- The new PIN.protected PasswordCallbackInfo makePWCBInfo()
protected boolean userPasswordIsCorrect(byte[] pw) throws TokenException
protected void changePassword(byte[] oldPIN, byte[] newPIN) throws IncorrectPasswordException, TokenException
public java.lang.String getName()
public java.security.Provider getProvider()
public CryptoStore getCryptoStore()
public boolean equals(java.lang.Object obj)
compare
is null.public boolean doesAlgorithm(Algorithm alg)
public java.lang.String generateCertRequest(java.lang.String subject, int keysize, java.lang.String keyType, byte[] P, byte[] Q, byte[] G) throws TokenException, java.security.InvalidParameterException, PQGParamGenException
subject
- subject dn of the certificatekeysize
- size of the keykeyType
- "rsa" or "dsa"P
- The DSA prime parameterQ
- The DSA sub-prime parameterG
- The DSA base parameterprotected java.lang.String generatePK10(java.lang.String subject, int keysize, java.lang.String keyType, byte[] P, byte[] Q, byte[] G) throws TokenException, java.security.InvalidParameterException
TokenProxy getProxy()
public boolean isInternalCryptoToken()
public boolean isInternalKeyStorageToken()
|
JSS 3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |