|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.crypto.CryptoSmartCardKeyStoreData
public class CryptoSmartCardKeyStoreData
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.
Constructor Summary | ||
---|---|---|
|
CryptoSmartCardKeyStoreData(AssociatedData[] associatedData,
String label,
PrivateKey privateKey,
SymmetricKey symmetricKey,
int securityLevel,
Certificate certificate,
CertificateStatus certStatus,
PublicKey publicKey,
long keyUsage)
Adds a KeyStoreData class containing the information that will be associated with the array of aliases contained
inside this class. |
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 the data that is associated with the long passed into this method. |
|
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()
Returns the private key contained within the key store data. |
|
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. |
|
CertificateStatus |
getStatus()
Retrieves the CertificateStatus for this object |
|
SymmetricKey |
getSymmetricKey()
Returns the symmetric key contained within 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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CryptoSmartCardKeyStoreData(AssociatedData[] associatedData, String label, PrivateKey privateKey, SymmetricKey symmetricKey, int securityLevel, Certificate certificate, CertificateStatus certStatus, PublicKey publicKey, long keyUsage)
KeyStoreData
class containing the information that will be associated with the array of aliases contained
inside this class.
Note: ANY OF THESE PARAMETERS CAN BE NULL without causing any problems for the key store.
associatedData
- An associated Data array containing all of the
aliases to index this record on in the keystore. This can be null and we
will simply rely on other indices added to the KeyStore to find your key.label
- The label that is shown to the user when the private key is accessed. This gives
the user some information about what private key is being accessed so they can make a informed
decision about inputting their private key password to unlock the key. It should be noted that this label
will have a string prefixed to it such as "Please enter your passphrase for: " and then your string.privateKey
- The private key data to be stored in the keystore.symmetricKey
- A symmetric key to be stored in the key store.securityLevel
- The security level associated with this key store data private key. That is, when
someone attempts to access the private key they will be prompted according to the security level of the
key store data.
High | The user will be asked for a passphrase |
Low | The user will not be prompted. |
Note: Once the security level is set it cannot be changed.
certificate
- A certificate corresponding to this key store data.certStatus
- The certificate status that is accompanying the certificate for this key store data.publicKey
- The public key data associated with the private key that will be stored
in the key store. Note that we make no restrictions on what is stored in these records.
The public key does not have to match the private key (make a key pair) if not desired.
Note: This method does not affect any underlying keystores.keyUsage
- Specifies the key usage of the key - see KeyUsage
. These fields can be OR'd together
to produce the correct key usage stored as an integer.Method Detail |
---|
public SymmetricKey getSymmetricKey(KeyStoreDataTicket ticket)
getSymmetricKey
in interface KeyStoreData
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
).
public SymmetricKey getSymmetricKey()
public PrivateKey getPrivateKey(KeyStoreDataTicket ticket)
getPrivateKey
in interface KeyStoreData
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
).
public PrivateKey getPrivateKey()
getTicket
).
public boolean isPrivateKeySet()
isPrivateKeySet
in interface KeyStoreData
public boolean isSymmetricKeySet()
isSymmetricKeySet
in interface KeyStoreData
public PublicKey getPublicKey()
Note: You do not need to know the passphrase to access the public key.
getPublicKey
in interface KeyStoreData
public Certificate getCertificate()
Note: You do not need to know the passphrase to access the certificate.
getCertificate
in interface KeyStoreData
public void setLabel(String newLabel)
setLabel
in interface KeyStoreData
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.
public String getLabel()
Note: You do not need to know the passphrase to access the label.
getLabel
in interface KeyStoreData
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!!
changePassword
in interface KeyStoreData
public int queryKeyUsage(long purpose)
queryKeyUsage
in interface KeyStoreData
purpose
- This is the context or purpose that you are trying to
determine if the key usage allows. See KeyUsage
KeyUsageResult
.public byte[][] getAssociatedData(long association)
getAssociatedData
in interface KeyStoreData
association
- The long used to identify which data to return to the user.
public AssociatedData[] getAssociatedData()
getAssociatedData
in interface KeyStoreData
association
- The long used to identify which data to return to the user.
public KeyStoreDataTicket getTicket()
This method may prompt for a passphrase from user.
getTicket
in interface KeyStoreData
public KeyStoreDataTicket getTicket(String prompt)
This method may prompt for a passphrase from user.
getTicket
in interface KeyStoreData
prompt
- an additional string provided to the allow the application developer to customize
the ticket prompt dialog to better fit their application needs.
public boolean checkTicket(KeyStoreDataTicket ticket)
checkTicket
in interface KeyStoreData
ticket
- the KeyStoreDataTicket we want to check.
public int getSecurityLevel()
getSecurityLevel
in interface KeyStoreData
public int getPasswordVersion()
getPasswordVersion
in interface KeyStoreData
public CertificateStatus getStatus()
CertificateStatus
stored for this
smart card key store data on the device. May be null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2010 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. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.