|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.rsa.certj.Provider | +--com.rsa.certj.provider.db.NativeDB
This class implements a database provider that stores data in a persistent local database. Database entries are stored as records in files in the local file system. The database engine is an embedded, high-performance engine that is suitable for managing small to medium numbers of entries.
Database Names Databases are identified by a 1 to 32 character name that is assigned when the database is created. It is one of the parameters of each constructor in the class. An individual database consists of several files, all stored in the same directory. It is not necessary to create each database in a different directory. Multiple databases and all their associated files can reside in the same directory, because the database service provider keeps track of the files that belong with a particular database name. Database Structure and File Names Each database consists of three components: one stores certificates, a second one stores CRLs, and a third one stores private keys. Each component consists of three local files, each of which has a different file type extension:cdx
, dbf
, or fpt
.
Each database consists of nine local files.
In addition, the NativeDB
provider creates master
table files in each directory that contains databases.
The master table files keep information about all the databases
stored in the directory. The master table files
are called rsadb.cdx
and rsadb.dbf
.
The NativeDB
provider does not use the database
name passed to the class to form the names of the
the database files. Instead it maps each database name to a
particular ID, and uses the ID to determine the name
of each database file. The mapping information and the database
file names are stored in the master table files.
Example
If you provide MyDatabase
as the name of a database to be created, and it is mapped to the
ID aaaaaaa
, nine files are created.
Three files for certificate storage:
NativeDB
object,
supply a password to be used
for private-key operations during that session. Each time a
private key is inserted into the database, it is encrypted using
the password. When a private key is retrieved from the database,
the database provider attempts to decrypt the record using the
supplied password. If the decryption succeeds, the private key is
returned.
It is possible to store private keys encrypted with
differing passwords in the same database. To change the
password, first unregister the service provider and then
re-register it with a different password.
Private-key database operations involves encryption
operations that use random numbers.
If you do not register a random service provider, the default
random service provider is used.
Copyright © RSA Security Inc., 1999-2001. All rights reserved.
Constructor Summary |
|
NativeDB(String name,
File path,
String databaseName,
char[] password,
boolean newDatabase)
Constructs a |
|
NativeDB(String name,
String pathString,
String databaseName,
char[] password,
boolean newDatabase)
Constructs a |
Method Summary |
|
static boolean |
create(File path,
String databaseName)
Creates |
static boolean |
create(String pathString,
String databaseName)
Creates |
static boolean |
delete(File path,
String databaseName)
Deletes |
static boolean |
delete(String pathString,
String databaseName)
Deletes |
instantiate(CertJ certJ)
Creates a |
|
static String[] |
listAllDatabaseNames(File path)
Returns a list of all of the |
static String[] |
listAllDatabaseNames(String pathString)
Returns a list of all of the |
Methods inherited from class com.rsa.certj.Provider |
getName, getType |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NativeDB(String name, String pathString, String databaseName, char[] password, boolean newDatabase) throws InvalidParameterException, DatabaseException
NativeDB
object. The location of the
database is given as a String
. If the database
is new, set the boolean
argument
newDatabase to true
.Parameters
name | A | ||
pathString | A | ||
databaseName | A | ||
password | A | ||
newDatabase | A |
Throws
InvalidParameterException
- If any
argument is invalid.
DatabaseException
- If there is some
unrecoverable error in the database.public NativeDB(String name, File path, String databaseName, char[] password, boolean newDatabase) throws InvalidParameterException, DatabaseException
NativeDB
object. The location of the
database is given as a File
. If the database
is new, set the boolean
argument
newDatabase to true
.Parameters
name | A | ||
path | A | ||
databaseName | A | ||
password | A | ||
newDatabase | A |
Throws
InvalidParameterException
- If any
argument is invalid.
DatabaseException
- If there is some
unrecoverable error in the database.Method Detail |
public static boolean create(String pathString, String databaseName) throws InvalidParameterException, DatabaseException
NativeDB
database storage for the
database, databaseName, in the directory
path when the path parameter
is a String
.Parameters
pathString | A | ||
databaseName | A |
Returns
boolean
value that indicates whether
the database was created successfully.
Throws
InvalidParameterException
- If
pathString and/or databaseName is
null
.
DatabaseException
- If there is some
unrecoverable error in the database.public static boolean create(File path, String databaseName) throws InvalidParameterException, DatabaseException
NativeDB
database storage for the
database, databaseName, in the directory,
path, when the path parameter is a File
.Parameters
path | A | ||
databaseName | A |
Returns
boolean
that indicates whether the
database was created successfully.
Throws
InvalidParameterException
- If
path and/or databaseName is null
.
DatabaseException
- If there is some
unrecoverable error in the database.public static boolean delete(String pathString, String databaseName) throws InvalidParameterException, DatabaseException
NativeDB
database storage for the
database, databaseName, that is located at
path, when the path parameter is a String
.Parameters
pathString | A | ||
databaseName | A |
Returns
boolean
value that indicates whether
the deletion of the database is successful.
Throws
InvalidParameterException
- If
pathString and/or databaseName is
null
.
DatabaseException
- If there is some
unrecoverable error in the database.public static boolean delete(File path, String databaseName) throws InvalidParameterException, DatabaseException
NativeDB
database storage for the
database, databaseName, that is located at
path, when the path parameter is a File
.Parameters
path | A | ||
databaseName | A |
Returns
boolean
value that indicates whether
the deletion of the database is successful.
Throws
InvalidParameterException
- If
path and/or databaseName is null
.
DatabaseException
- If there is some
unrecoverable error in the database.public static String[] listAllDatabaseNames(String pathString) throws InvalidParameterException, DatabaseException
NativeDB
database
names in the directory, pathString,
when the directory name is a String
.Parameters
pathString | A |
Returns
String
array that contains all the
database names found, or null
if none is found.
Throws
InvalidParameterException
- If
pathString is null
.
DatabaseException
- If there is some
unrecoverable error in the database.public static String[] listAllDatabaseNames(File path) throws InvalidParameterException, DatabaseException
NativeDB
database
names in the directory, path,
when the directory name is a File
.Parameters
path | A |
Returns
String
array that contains all the
database names found, or null
if none is found.
Throws
InvalidParameterException
- If
path is null
.
DatabaseException
- If there is some
unrecoverable error in the database.public ProviderImplementation instantiate(CertJ certJ) throws ProviderManagementException
ProviderImplementation
object that
handles the database SPI methods for the NativeDB
provider.
It throws an exception if the newDatabase
argument is set to true
, and there already exists
a database named databaseName
at the location
path
. This method is called by
CertJ.registerService
when an object of the
NativeDB
class is being registered;
applications do not have to call this method.Overrides
instantiate
in class Provider
Parameters
certJ | A |
Returns
ProviderImplementation
object that
handles the NativeDB
Database SPI methods.
Throws
ProviderManagementException
- If
instantiation of the NativeDB
provider fails.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |