net.rim.device.api.system
Class CodeSigningKey

java.lang.Object
  |
  +--net.rim.device.api.system.CodeSigningKey
All Implemented Interfaces:
Persistable, Persistable

public final class CodeSigningKey
extends Object
implements Persistable

Provides access to code signing keys to facilitate run-time access checking.

 PersistentObject controlledStore = PersistentStore.getPersistentObject(PERSISTENT_STORE_DEMO_CONTROLLED_ID); 
 synchronized(controlledStore)
 {   
     CodeSigningKey codeSigningKey = CodeSigningKey.get( CodeModuleManager.getModuleHandle( "PersistentStoreDemo" ), "ACME" );
     controlledStore.setContents( new ControlledAccess(new Vector(), codeSigningKey));                        
     PersistentObject.commit(controlledStore);                        
 }
 
Please see “PersistentStoreDemo” for more information.

Since:
JDE 3.6.0

Field Summary
static int RBB_SIGNER_ID
          ID for the RIM BlackBerry signing authority.
static int RCC_SIGNER_ID
          ID for the RIM Crypto Certicom signing authority.
static int RCR_SIGNER_ID
          ID for the RIM Crypto Runtime signing authority.
static int RRT_SIGNER_ID
          ID for the RIM Runtime signing authority.
 
Constructor Summary
CodeSigningKey(int signerId, byte[] publicKey, String description)
          Creates new CodeSigningKey instance.
CodeSigningKey(String signerId, byte[] publicKey, String description)
          Creates new CodeSigningKey instance.
 
Method Summary
static String convert(int i)
          Retrieves string form of integer ID.
static int convert(String s)
          Retrieves integer form of string ID
 boolean equals(Object obj)
          Determines whether provided object is equivalent to this code signing key.
static CodeSigningKey get(int moduleHandle, int signerId)
          Retrieves code signing information associated with numeric signer ID.
static CodeSigningKey get(int moduleHandle, String signerId)
          Retrieves code signing information associated with numeric signer ID.
static CodeSigningKey get(Object obj)
          Retrieves code signing information for provided object.
 String getDescription()
          Retrieves description of Signing Authority.
 byte[] getPublicKey()
          Retrieves public key.
 String getSignerId()
          Retrieves signer's ID.
 int getSignerIdAsInt()
          Retrieves signer's ID as integer.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail


RBB_SIGNER_ID

public static final int RBB_SIGNER_ID
ID for the RIM BlackBerry signing authority.
Since:
JDE 3.6.0

RCC_SIGNER_ID

public static final int RCC_SIGNER_ID
ID for the RIM Crypto Certicom signing authority.
Since:
JDE 3.6.0

RCR_SIGNER_ID

public static final int RCR_SIGNER_ID
ID for the RIM Crypto Runtime signing authority.
Since:
JDE 3.6.0

RRT_SIGNER_ID

public static final int RRT_SIGNER_ID
ID for the RIM Runtime signing authority.
Since:
JDE 3.6.0
Constructor Detail

CodeSigningKey

public CodeSigningKey(int signerId,
                      byte[] publicKey,
                      String description)
Creates new CodeSigningKey instance.

Parameters:
signerId - ID of the Signing Authority (you can find this value by looking at the properties of the key file). Note that this argument must not exceed four characters in length, otherwise an IllegalArgumentException will be thrown.
publicKey - Public key data.
description - Description or name of the Signing Authority.
Since:
JDE 3.6.0

CodeSigningKey

public CodeSigningKey(String signerId,
                      byte[] publicKey,
                      String description)
Creates new CodeSigningKey instance.

Parameters:
signerId - ID of the Signing Authority (typically this is the filename of the key file). Note that this argument must not exceed four characters in length, otherwise an IllegalArgumentException will be thrown.
publicKey - Public key data.
description - Description or name of the Signing Authority.
Since:
JDE 3.6.0
Method Detail

convert

public static String convert(int i)
Retrieves string form of integer ID.

Parameters:
i - Integer form of a signer ID.
Returns:
String form of signer's ID.
Since:
JDE 3.6.0

convert

public static int convert(String s)
Retrieves integer form of string ID

Parameters:
s - String form of a signer ID. Note that this argument must not exceed four characters in length, or be null, otherwise an IllegalArgumentException will be thrown.
Returns:
Integer form of signer's ID.
Throws:
IllegalArgumentException - Thrown if the specified ID is greater than four characters in length or if the value is null.
Since:
JDE 3.6.0

equals

public boolean equals(Object obj)
Determines whether provided object is equivalent to this code signing key.

Use this method to test whether a provided object is equal to this code signing key. This is true if and only if the signer IDs match, the public keys match, and the descriptions match.

Overrides:
equals in class Object
Parameters:
obj - Object to test against this one for equality.
Returns:
True if provided object is equivalent to this code signing key; otherwise, false.
Since:
JDE 3.6.0

get

public static CodeSigningKey get(int moduleHandle,
                                 int signerId)
Retrieves code signing information associated with numeric signer ID.

Parameters:
moduleHandle - Handle to the code module containing the key information.
signerID - ID for code signer.
Returns:
Code signing information for provided signer ID, or null if no signing information exists for that signer.
Since:
JDE 3.6.0

get

public static CodeSigningKey get(int moduleHandle,
                                 String signerId)
Retrieves code signing information associated with numeric signer ID.

Parameters:
moduleHandle - Handle to the code module containing the key information.
signerID - ID for code signer.
Returns:
Code signing information for provided signer ID, or null if no signing information exists for that signer.
Since:
JDE 3.6.0

get

public static CodeSigningKey get(Object obj)
Retrieves code signing information for provided object.

Parameters:
obj - Object for which to retrieve the code signing information.
Returns:
Code signing information for provided object, or null if no signing information exists for that object.
Since:
JDE 3.6.0

getDescription

public String getDescription()
Retrieves description of Signing Authority.

Returns:
Signing Authority description.
Since:
JDE 3.6.0

getPublicKey

public byte[] getPublicKey()
Retrieves public key.

Returns:
Public key data.
Since:
JDE 3.6.0

getSignerId

public String getSignerId()
Retrieves signer's ID.

Returns:
Signer's ID as a string.
Since:
JDE 3.6.0

getSignerIdAsInt

public int getSignerIdAsInt()
Retrieves signer's ID as integer.

Returns:
Signer's ID as an integer.
Since:
JDE 3.6.0



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.