This class allows a developer to combine several keystores
into what looks like one keystore.
This is useful
when you have several keystores that might contain the
key you are looking for. You can combine these keystores
temporarily and search through them.
Note: It should be noted that some
operations do not make sense to operate on a collection of keystores.
For example, the set method would add a new key to a keystore. It does not
make sense to add the new key automatically to all of the keystores.
So, the concept of a preferred keystore exists to enable
those kinds of operations to be performed on one of the keystores.
Any operation that only operates on a preferred key store is denoted
as such. Ensure that you check the javadocs for each function you
are calling so you know exactly what operations are being performed.
For sample code on how to use a key store see:
here
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Since:
JDE 3.6.0
Field Summary
Fields inherited from interface net.rim.device.api.crypto.keystore.KeyStore
CombinedKeyStore(KeyStore[] keyStores)
Initializes the combined keystore with an array of underlying
keystores.
CombinedKeyStore(KeyStore[] keyStores,
int preferredKeyStore)
Initializes the combined keystore with an array of underlying
keystores.
Method Summary
void
addCollectionListener(Object listener)
This method is called when the developer wants to
listen in on when records are added and removed
to/from a particular keystore.
boolean
addIndex(KeyStoreIndex index)
Adds an index to all of the information currently in
the key store.
void
addIndices(KeyStoreIndex[] indices)
Adds an array of indices to all of the information currently in
the key store.
void
addKeyStores(KeyStore[] keyStores)
Allows for the addition of more keystores to the
combined key store.
void
changePreferredKeyStore(int newPreferredKeyStore)
Allows you to change the preferred key store.
elements(long index,
boolean backingKeyStore)
Returns an enumeration of the elements (KeyStoreData)
inside the key store according to the index provided
with the parameter.
elements(long index,
Object associatedData)
Returns an array of keystore information that contains
the certificates, keys and other data associated with this
alias.
elements(long index,
Object associatedData,
boolean backingKeyStore)
Returns an array of keystore information that contains
the certificates, keys and other data associated with this
alias.
boolean
exists(long index,
Object associatedData)
Returns a boolean denoting whether an object exists with
the given alias and the given index class.
boolean
existsIndex(long index)
Returns a boolean denoting whether this index already exists in
the key store.
Initializes the combined keystore with an array of underlying
keystores.
You can also add to this array later on if desired.
It should be noted that by default the preferred keystore will
be the first keystore given in the array unless otherwise
specified.
Parameters:
keyStores - The array of keystores that you want as part
of the combined keystore.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
CombinedKeyStore
public CombinedKeyStore(KeyStore[] keyStores,
int preferredKeyStore)
Initializes the combined keystore with an array of underlying
keystores.
You can also add to this array later on if desired.
Parameters:
keyStores - The array of keystores that you want as part
of the combined keystore.
preferredKeyStore - An integer representing the index within
the array of keystores that will be considered the preferred
keystore. The preferred keystore will be the keystore that new keys
are added to and other operations that are not obviously made
for multiple key stores. (i.e. anything that causes a change
in the state of a keystore). Remember that arrays are indexed
at zero. Hence, if you want the very first keystore to be the preferred
keystore it would have an index of 0.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
The new key exists exactly as it did in the original keystore implementation.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
The new key exists exactly as it did in the original keystore implementation.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
The new key exists exactly as it did in the original keystore implementation.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
The new key exists exactly as it did in the original keystore implementation.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
The new key exists exactly as it did in the original keystore implementation.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
The new key exists exactly as it did in the original keystore implementation.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Returns an array of keystore information that contains
the certificates, keys and other data associated with this
alias.
Parameters:
index - A long representing the Index class that
denotes where to find the associatedData and how it is used.
associatedData - An object denoting which key store information
should be returned.
Returns:
An enumeration of all of the keystore data objects ( KeyStoreData ) that
fit the description given by the index and alias.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
elements
public Enumerationelements(long index,
Object associatedData,
boolean backingKeyStore)
Returns an array of keystore information that contains
the certificates, keys and other data associated with this
alias.
Parameters:
index - A long representing the Index class that
denotes where to find the associatedData and how it is used.
associatedData - An object denoting which key store information
should be returned.
Returns:
An enumeration of all of the keystore data objects ( KeyStoreData ) that
fit the description given by the index and alias.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Returns an enumeration of the KeyStoreData
that are stored in the KeyStore.
Note that this is akin to retrieving an enumeration
of all the keys in every keystore in the combined
keystore. Note that this function will not return
any KeyStoreData records from the backing keystore.
Returns:
An enumeration of keystore data objects ( KeyStoreData ).
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
elements
public Enumerationelements(boolean backingKeyStore)
Returns an enumeration of the KeyStoreData
that are stored in the KeyStore.
Note that this is akin to retrieving an enumeration
of all the keys in every keystore in the combined
keystore.
Parameters:
backingKeyStore - if true this method will return
the elements from the backing key store as well.
Returns:
An enumeration of keystore data objects ( KeyStoreData ).
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Returns an enumeration of the elements (KeyStoreData)
inside the key store according to the index provided
with the parameter.
Parameters:
index - A long representing what index to return
an enumeration of the elements for.
Returns:
An enumeration of keystore data objects ( KeyStoreData ).
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
elements
public Enumerationelements(long index,
boolean backingKeyStore)
Returns an enumeration of the elements (KeyStoreData)
inside the key store according to the index provided
with the parameter.
Parameters:
index - A long representing what index to return
an enumeration of the elements for.
Returns:
An enumeration of keystore data objects ( KeyStoreData ).
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
exists
public boolean exists(long index,
Object associatedData)
Returns a boolean denoting whether an object exists with
the given alias and the given index class.
Parameters:
index - The long denoting the index class.
associatedData - An object representing the associated data to the key store
information.
Returns:
A boolean that indicates if the object exists.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Adds an index to all of the information currently in
the key store.
This enables the developer to access
information in the key store according to this new associatedData field.
For a combined key store this will add the index to all of the
underlying keystores.
Parameters:
index - An Index class that is implemented by the developer.
It denotes the key store information is indexed
according to fields currently contained in key store objects such
as certificates.
Returns:
A boolean denoting if the index was added correctly. Return false if the index already exists.
This method may return false if the index exists in one of the many keystores in the combined keystore.
It will however be added to any of the keystores that this index is not already added to even if it returns
false.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Adds an array of indices to all of the information currently in
the key store.
This enables the developer to access
information in the key store according to this new associatedData field.
For a combined key store this will add the index to all of the
underlying keystores.
Parameters:
indices - A KeyStoreIndex class that is implemented by the developer.
It denotes the key store information is indexed
according to fields currently contained in key store objects such
as certificates.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
removeIndex
public void removeIndex(long index)
Removes an index from all of the keystores in the combined keystore.
Parameters:
index - the long representing the ID of the index to remove.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
existsIndex
public boolean existsIndex(long index)
Returns a boolean denoting whether this index already exists in
the key store.
In the combined keystore this will return a boolean if and only
if all of the keystores underlying the combined keystore have
an index specified as the parameter.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
size
public int size()
Returns the number of elements inside the key store.
For the combined key store this returns the number
of elements in all of the keystores added together.
That is, if you had five elements in one key store
and six elements in a second key store then this would
return 11 elements.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Allows for the addition of more keystores to the
combined key store.
Note This will not make the distinction of checking to see if a keystore
has already been added to the combined keystore. This is
left to the developer since there is no real way to
uniquely identify a keystore.
Parameters:
keyStores - An array of additional key stores
that will be added to the combined key store.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Allows you to remove a keystore from the combined keystore.
Parameters:
index - the index into the array of keystores that you would
like to remove.
Throws:
IllegalArgumentException - Thrown if the integer is not
in the following range 0 < x < size where x is the
new preferred key store and size is the number of keystores
currently in the combined key store.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Allows you to change the preferred key store.
This will now be the keystore that will have
all of the modifying operations performed on it.
Parameters:
newPreferredKeyStore - A new key store index
that will be used to index into the array of stored
keystores.
Throws:
IllegalArgumentException - Thrown if the integer is not
in the following range 0 < x < size where x is the
new preferred key store and size is the number of keystores
currently in the combined key store.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Calls the getTicket method on the preferred key store.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Calls the getTicket method on the preferred key store.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Calls the checkTicket method on the preferred key store.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Returns a boolean dictating whether or not this certificate is contained inside
the KeyStore.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
isMember
public boolean isMember(byte[] certificateEncoding)
Returns a boolean dictating whether or not this certificate is contained inside
the KeyStore.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Returns a boolean dictating whether or not this key is contained inside
the KeyStore.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Returns a boolean dictating whether or not this KeyStoreData is contained inside
the KeyStore.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
addCollectionListener
public void addCollectionListener(Object listener)
This method is called when the developer wants to
listen in on when records are added and removed
to/from a particular keystore. This method will add
a collection listener to all of the keystores in this
combined keystore.
Note: This does not add the listener to the underlying keystore.
Parameters:
listener - The KeyStoreListener interface
that must be implemented by the calling class
which will be called when a record is added or
removed.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
removeCollectionListener
public void removeCollectionListener(Object listener)
This method is called when the developer wants to
remove the listener from this keystore. This method will add
a collection listener to all of the keystores in this
combined keystore.
Note: This does not remove the listener from the underlying keystore.
Parameters:
listener - The KeyStoreListener to be removed.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
This method returns the backing keystore
for the preferred keystore currently set
in the combined keystore.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
getNumKeyStores
public int getNumKeyStores()
This method returns the number of keystores that are currently
contained in the CombinedKeyStore. This allows one to find
out exactly which KeyStores are contained in the CombinedKeyStore.
Returns:
the number of KeyStores contained in the CombinedKeyStore.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
This method returns the KeyStore associated with the index
specified as the only parameter. If this index is less than
0 or greater than the number of keystores then this will throw
an IllegalArgumentException.
Parameters:
index - the index into the array of KeyStores that we should return.
Returns:
the KeyStore associated with the index passed into the method.
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Copyright 1999-2006 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.