|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.rim.device.api.crypto.keystore.KeyStorePasswordManager
Provides all of the keystore password functionality for the keystore.
This includes functionality of remembering how many attempts at the password, forcing the user to enter the password, remembering the password for a timeout period and other important functions. You should only use the key store password class when trying to determine if someone knows the key store password.
| Method Summary | ||
|
void |
challenge()
Displays the password dialog and prompts the user to enter a correct password. |
|
void |
challenge(String label)
Displays a custom password dialog and prompts the user to enter a correct password. |
|
void |
changePassword()
This function is called to change the KeyStore password on the device. |
|
boolean |
checkTicket(KeyStorePasswordTicket ticket)
Checks to make sure that the ticket is valid and that it is of the appropriate type. |
|
boolean |
clean()
This method is called when the user wants to clean out the keystore information requiring the entry of the password the next time they try to access anything in the keystore. |
|
byte[] |
decrypt(int securityLevel,
long salt,
byte[] input,
int offset,
int length,
String label,
KeyStorePasswordTicket ticket)
Returns the byte array that is decrypted with the password. |
|
byte[] |
decrypt(int securityLevel,
long salt,
byte[] input,
String label,
KeyStorePasswordTicket ticket)
Returns the byte array that is decrypted with the password. |
|
byte[] |
decryptReEncrypt(int securityLevel,
long salt,
byte[] ciphertext)
During a change password operation this helper function allows an easy way to change the encryption of an object from the old password to the new password. |
|
byte[] |
encrypt(int securityLevel,
long salt,
byte[] input,
int offset,
int length,
String label,
KeyStorePasswordTicket ticket)
Returns the byte array that is encrypted with the password. |
|
byte[] |
encrypt(int securityLevel,
long salt,
byte[] input,
String label,
KeyStorePasswordTicket ticket)
Returns the byte array that is encrypted with the password. |
|
static KeyStorePasswordManager |
getInstance()
|
|
KeyStorePasswordTicket |
getTicket()
Returns a ticket if the operation to retrieve one was successful. |
|
byte[] |
setPassword()
Sets the password by prompting the user for it and then asking for its confirmation. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static KeyStorePasswordManager getInstance()
public void challenge()
throws KeyStoreCancelException
KeyStoreCancelException - Thrown if the user fails to enter a
valid password or cancels out of the password dialog.public void challenge(String label) throws KeyStoreCancelException
label - The text label for the password dialog.KeyStoreCancelException - Thrown if the user fails to enter a
valid password or cancels out of the password dialog.
public byte[] encrypt(int securityLevel,
long salt,
byte[] input,
String label,
KeyStorePasswordTicket ticket)
throws KeyStoreCancelException
securityLevel - The security level.salt - The salt that is used to encrypt the password. This should be random.input - The input byte array that is to be encrypted.label - a label that will be shown to the user when they are prompted to encrypt their data.ticket - A ticket denoting whether or not the developer has access to the keystore. A ticket can be retrieved
from the getTicket method in the key store or keystore data. The ticket can also be null which will most likely
prompt for a password from the user automatically (calls
getTicket).KeyStoreCancelException - Thrown when the user cancels out of the simple password
dialog since they appear to not want to enter their password.
public byte[] encrypt(int securityLevel,
long salt,
byte[] input,
int offset,
int length,
String label,
KeyStorePasswordTicket ticket)
throws KeyStoreCancelException
securityLevel - The security level.salt - The salt that is used to encrypt the password. This should be random.input - The input byte array that is to be encrypted.offset - The offset into the byte array to be encrypted.length - The number of bytes to be encrypted.label - a label that will be shown to the user during the prompt for their passphrase if necessary.ticket - A ticket denoting whether or not the developer has access to the keystore. A ticket can be retrieved
from the getTicket method in the key store or keystore data. The ticket can also be null which will most likely
prompt for a password from the user automatically (essentially calls getTicket for you).KeyStoreCancelException - Thrown when the user cancels out of the simple password
dialog since they appear to not want to enter their password.
public byte[] decrypt(int securityLevel,
long salt,
byte[] input,
String label,
KeyStorePasswordTicket ticket)
throws KeyStoreCancelException,
KeyStoreDecodeException
securityLevel - The security level.salt - The salt that is used to encrypt the password. This should be random.input - The input byte array that is to be encrypted.label - a string that will be shown to the user on a prompt for passphrase if necessary.ticket - A ticket denoting whether or not the developer has access to the keystore. A ticket can be retrieved
from the getTicket method in the key store or keystore data. The ticket can also be null which will most likely
prompt for a password from the user automatically (essentially calls
getTicket for you).KeyStoreCancelException - Thrown when the user cancels out of the simple password
dialog since they appear to not want to enter their password.KeyStoreDecodeException - if the keystore was unable to decrypt the
ciphertext given that the security level was incorrect or the password was somehow
incorrect.
public byte[] decrypt(int securityLevel,
long salt,
byte[] input,
int offset,
int length,
String label,
KeyStorePasswordTicket ticket)
throws KeyStoreCancelException,
KeyStoreDecodeException
securityLevel - The security level.salt - The salt that is used to decrypt the password. This should be random.input - The input byte array that is to be decrypted.offset - The offset into the byte array to be decrypted.length - The number of bytes to be decrypted.label - A string that will be shown to the user when prompting for a passphrase if necessary.ticket - A ticket denoting whether or not the developer has access to the keystore. A ticket can be retrieved
from the getTicket method in the key store or keystore data. The ticket can also be null which will most likely
prompt for a password from the user automatically (essentially calls
getTicket for you).KeyStoreCancelException - Thrown when the user cancels out of the simple password
dialog since they appear to not want to enter their password.KeyStoreDecodeException - if the keystore was unable to decrypt the
ciphertext given that the security level was incorrect or the password was somehow
incorrect.
public void changePassword()
throws KeyStoreCancelException
This function prompts for the old password and the new password. It ensures that the old password is correct and then proceeds. If the old password is incorrect it continues to prompt until the maximum number of attempts is reached.
KeyStoreCancelException - Thrown when the user cancels out of the simple password
dialog since they appear to not want to enter their password.
public byte[] decryptReEncrypt(int securityLevel,
long salt,
byte[] ciphertext)
throws KeyStoreDecodeException
It is important to note that this will take in a byte array that is encrypted with the old password and return a new byte array that is encrypted with the new password. Everything is seamless to the user.
securityLevel - An integer representing the security level.salt - The salt used to encrypt the data. Must be random. Note that the salt
is going to be the same for the old ciphertext and the new ciphertext.ciphertext - A byte array containing the ciphertext.InvalidKeyEncodingException - Thrown if the key is improperly encoded.KeyStoreDecodeException - if the keystore was unable to decrypt the
ciphertext given that the security level was incorrect or the password was somehow
incorrect.public KeyStorePasswordTicket getTicket() throws KeyStoreCancelException
This will typically prompt for a password and will return a key store ticket if successful. If not this method can return null.
KeyStoreCancelException - Thrown when the user cancels out of the simple password
dialog since they appear to not want to enter their password.public boolean checkTicket(KeyStorePasswordTicket ticket)
ticket - The specified ticket.
public byte[] setPassword()
throws KeyStoreCancelException
KeyStoreCancelException - Thrown when the user cancels out of the simple password
dialog since they appear to not want to enter their password.public boolean clean()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2002 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.