|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
A container class used to store all of the key store information. This includes objects like certificates, keys, and other information. It should be noted that this class has UI functionality when it prompts for passphrases depending on the security level established with the key objects.
KeyStore,
KeyStoreIndex| Method Summary | ||
|
void |
changePassword()
Changes the passphrase. |
|
boolean |
checkTicket(KeyStoreDataTicket ticket)
Returns a boolean denoting whether or not this ticket will work for this KeyStoreData record. |
|
AssociatedData[] |
getAssociatedData()
Returns an array of AssociatedData objects that were passed into this KeyStoreData. |
|
byte[][] |
getAssociatedData(long association)
Returns the data that is associated with the long passed into this method. |
|
Certificate |
getCertificate()
Returns the certificate that is stored in the key store data object. |
|
String |
getLabel()
Returns the label associated with this class. |
|
int |
getPasswordVersion()
Returns the current password version of this KeyStoreData object. |
|
PrivateKey |
getPrivateKey(KeyStoreDataTicket ticket)
Returns the private key contained within the key store data. |
|
PublicKey |
getPublicKey()
Returns the public key that is stored within the key store data object. |
|
int |
getSecurityLevel()
Returns the security level of the key store data. |
|
SymmetricKey |
getSymmetricKey(KeyStoreDataTicket ticket)
Returns the symmetric key contained within the key store data. |
|
KeyStoreDataTicket |
getTicket()
Returns a ticket detailing what type of access the calling application has in the keystore. |
|
KeyStoreDataTicket |
getTicket(String prompt)
Returns a ticket detailing what type of access the calling application has in the keystore. |
|
boolean |
isPrivateKeySet()
Returns a boolean dictating whether or not the private key has been set for this record without actually requiring knowledge of the passphrase to access the private key. |
|
boolean |
isSymmetricKeySet()
Returns a boolean dictating whether or not the symmetric key has actually been set for this record without actually requiring knowledge of the passphrase to access the symmetric key. |
|
int |
queryKeyUsage(long purpose)
This method returns an integer that that specifies whether the usage for the key allows this key to be used for the given purpose. |
|
void |
setLabel(String newLabel)
Sets the new label into the KeyStoreData record. |
| Method Detail |
public void changePassword()
KeyStorePasswordManager provides the KeyStorePasswordManager.decryptReEncrypt(int, long, byte[]) method
to decrypt and re-encrypt data.
Note for Implementors: If you are writing your own KeyStoreData class it is imperative that you implement this method correctly. If the password is changed and the structures inside the keystore are not updated then the keystore will be unable to decrypt the keys using the new password. This will essentially render the KeyStoreData class useless and perhaps even lost!!
public boolean checkTicket(KeyStoreDataTicket ticket)
ticket - the KeyStoreDataTicket we want to check.public AssociatedData[] getAssociatedData()
public byte[][] getAssociatedData(long association)
association - The long used to identify which data to return to the user.public Certificate getCertificate()
Note: You do not need to know the passphrase to access the certificate.
public String getLabel()
Note: You do not need to know the passphrase to access the label.
public int getPasswordVersion()
public PrivateKey getPrivateKey(KeyStoreDataTicket ticket) throws NoSuchAlgorithmException, InvalidKeyEncodingException, CryptoTokenException, CryptoUnsupportedOperationException, KeyStoreCancelException, KeyStoreDecodeException
NOTE: This method involves the use of UI and will prompt the user for the passphrase.
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 passphrase from the user automatically (essentially calls
getTicket).NoSuchAlgorithmException - Thrown when the specified cipher is invalid.InvalidKeyEncodingException - Thrown when the specified key is
improperly formatted.CryptoTokenException - Thrown when an error occurs with the crypto
token or the crypto token is invalid.CryptoUnsupportedOperationException - Thrown when a call is made to
an unsupported operation.KeyStoreCancelException - Thrown when the specified password is
invalid.KeyStoreDecodeException - Thrown when the underlying private was corrupted in some
manner and the keystore was unable to retrieve it.public PublicKey getPublicKey()
Note: You do not need to know the passphrase to access the public key.
public int getSecurityLevel()
public SymmetricKey getSymmetricKey(KeyStoreDataTicket ticket) throws NoSuchAlgorithmException, InvalidKeyEncodingException, CryptoTokenException, CryptoUnsupportedOperationException, KeyStoreCancelException, KeyStoreDecodeException
NOTE: This method involves the use of UI and will prompt the user for the passphrase.
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 passphrase from the user automatically (essentially calls getTicket).NoSuchAlgorithmException - Thrown when the specified cipher is invalid.InvalidKeyEncodingException - Thrown when the specified key is
improperly formatted.CryptoTokenException - Thrown when an error occurs with the crypto
token or the crypto token is invalid.CryptoUnsupportedOperationException - Thrown when a call is made to
an unsupported operation.KeyStoreCancelException - Thrown when the specified password is
invalid.KeyStoreDecodeException - Thrown when the underlying private was corrupted in some
manner and the keystore was unable to retrieve it.public KeyStoreDataTicket getTicket() throws KeyStoreCancelException
This method may prompt for a passphrase from user.
KeyStoreCancelException - Thrown if the user cancels the password
entry operation.public KeyStoreDataTicket getTicket(String prompt) throws KeyStoreCancelException
This method may prompt for a passphrase from user.
prompt - an additional string provided to the allow the application developer to customize
the ticket prompt dialog to better fit their application needs.KeyStoreCancelException - Thrown if the user cancels the password
entry operation.public boolean isPrivateKeySet()
public boolean isSymmetricKeySet()
public int queryKeyUsage(long purpose)
purpose - This is the context or purpose that you are trying to
determine if the key usage allows. See KeyUsageKeyUsageResult.public void setLabel(String newLabel) throws KeyStoreCancelException
newLabel - specifies the newLabel that will be set for this KeyStoreData.
If this field is null the KeyStore will actually prompt for the new label
for you.
Note: This method will pop up UI to ask for the new label given the old label and it will also ask for the password after asking for the new label. Note: You need to know the passphrase to set the label.
KeyStoreCancelException - if the user cancels entering their
password or cancels entering the new label.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.