RSA BSAFE CRYPTO-J

Cryptographic Components for Java

JSAFE Javadoc JCE Javadoc Search

JSAFE_PrivateKey Class Reference

This class holds private keys for all asymmetric operations and implements the JSAFE_Key class interface.

See Overview of Crypto-J for background and reference material on using and understanding Crypto-J.

Note: Not all Crypto-J transformations have OIDs assigned to them. See Crypto-J Transformations and Their Associated Classes for a list of transformations that have assigned OIDs.

Copyright © RSA Security Inc., 1997-2005. All rights reserved.

Inheritance diagram for JSAFE_PrivateKey:

JSAFE_Object JSAFE_Key List of all members.

Public Methods

String JSAFE_PrivateKey:: getDevice ()
 Returns the standard name of the device of record. More...

String [] JSAFE_PrivateKey:: getDeviceList ()
 Returns a String array that describes all the devices used to execute the transformation. More...

abstract String JSAFE_PrivateKey:: getAlgorithm ()
 Returns the standard algorithm name. More...

abstract Object JSAFE_PrivateKey:: clone () throws CloneNotSupportedException;
 Overrides the default clone method to produce a deep clone. More...

String JSAFE_PrivateKey:: getKeyWrappingFormat (boolean ber)
 Returns the name of the format to use when getting the data for key wrapping. More...

abstract boolean JSAFE_PrivateKey:: dataEquals (Object obj)
 Compares only the data of the objects, ignoring token info, if any. More...

void JSAFE_PrivateKey:: clearSensitiveData ()
 This method clears sensitive data from an object. More...


Static Public Methods

JSAFE_PrivateKey JSAFE_PrivateKey:: getInstance (byte[] berInfo, int offset, String device) throws JSAFE_UnimplementedException
 Builds an object that contains the private key defined in berInfo, beginning at offset. More...

int JSAFE_PrivateKey:: getNextBEROffset (byte[] keyBER, int offset) throws JSAFE_UnimplementedException
 Gets the next offset after the algorithm ID. More...

JSAFE_PrivateKey JSAFE_PrivateKey:: getInstance (String transformation, String device) throws JSAFE_UnimplementedException
 Builds an object that holds a private key for the transformation on the given device. More...


Member Function Documentation

void JSAFE_PrivateKey::clearSensitiveData   [inline];
 

This method clears sensitive data from an object. Although the finalizer clears the data, there is no guarantee the garbage collector will quickly call the finalizer. Allows a user to clear data as soon as possible. After calling clearSensitiveData(), an Init (not a ReInit) method is called to perform other operations with the object.

Implements JSAFE_Key.

abstract Object JSAFE_PrivateKey::clone   throws CloneNotSupportedException; [inline, pure virtual];
 

Overrides the default clone method to produce a deep clone.

Returns:
A copy of this object.
Exceptions:
CloneNotSupportedException If the object cannot be cloned.

Reimplemented from JSAFE_Object.

abstract boolean JSAFE_PrivateKey::dataEquals Object    obj [pure virtual];
 

Compares only the data of the objects, ignoring token info, if any. If both objects are empty, returns false.

Parameters:
obj The object to compare with.
Returns:
A boolean. Returns true if the two objects contain the same data; false otherwise.

abstract String JSAFE_PrivateKey::getAlgorithm   [pure virtual];
 

Returns the standard algorithm name.

Returns:
A String that describes the algorithm.

Implements JSAFE_Key.

String JSAFE_PrivateKey::getDevice   [inline];
 

Returns the standard name of the device of record. The choices are as follows: choice1[/choice2[...[/choicen]]]. The device values are as follows:

  • Native
  • Java
  • name of specified device
Returns:
The device name.

Implements JSAFE_Key.

String [] JSAFE_PrivateKey::getDeviceList   [inline];
 

Returns a String array that describes all the devices used to execute the transformation. Because a transformation often consists of component algorithms, the implementation can consist of several component objects. A device can perform one or more of the algorithms, but it may let Java or another device perform one or more. For example, because padding is not time-consuming, a device might let the Crypto-J implementation perform padding. Returns the names of the devices used by each component.

Returns the names of the devices used by each component.

Returns:
A String array that describes the device used for a specific component.

JSAFE_PrivateKey JSAFE_PrivateKey::getInstance String    transformation,
String    device
throws JSAFE_UnimplementedException [inline, static];
 

Builds an object that holds a private key for the transformation on the given device.

Parameters:
transformation The representation of the desired operation (for example, "RSA").
device A list of devices used to build the object (for example, "Java", "Native/Java").
Returns:
A new JSAFE_PrivateKey object to use with objects that perform the transformation.
Exceptions:
JSAFE_UnimplementedException If the device or devices cannot perform the designated algorithm.

JSAFE_PrivateKey JSAFE_PrivateKey::getInstance byte    berInfo[],
int    offset,
String    device
throws JSAFE_UnimplementedException [inline, static];
 

Builds an object that contains the private key defined in berInfo, beginning at offset. This is the BER encoding of the private-key information. The specified device is used.

Parameters:
berInfo A byte array containing the BER encoding of the key.
offset The offset into berInfo where the encoding begins.
device A list of devices used to build the object.
Returns:
A new JSAFE_PrivateKey object for the specified algorithm.
Exceptions:
JSAFE_UnimplementedException If the device or devices cannot perform the designated algorithm, or the toolkit cannot decode the BER encoding.

String JSAFE_PrivateKey::getKeyWrappingFormat boolean    ber [inline];
 

Returns the name of the format to use when getting the data for key wrapping. Use ber to specify whether the data returned should be BER-encoded.

Parameters:
ber A boolean indicating whether the data is wrapped BER-encoded (true) or not (false).
Returns:
A String that is the format.

Implements JSAFE_Key.

int JSAFE_PrivateKey::getNextBEROffset byte    keyBER[],
int    offset
throws JSAFE_UnimplementedException [inline, static];
 

Gets the next offset after the algorithm ID. Given the berAlgID, the BER encoding of the algorithm ID, beginning at offset, returns the index to the next byte in the array.

Parameters:
keyBER A byte array containing the BER encoding of a private key.
offset The offset into keyBER where the encoding begins.
Returns:
The index into keyBER of the byte following the key.
Exceptions:
JSAFE_UnimplementedException If the toolkit cannot decode the BER encoding.


Copyright (c) 1999-2005 RSA Security Inc. All rights reserved. 038-001001-3500-001-000 - 3.5