CXI
Loading...
Searching...
No Matches
Functions | Variables
Collaboration diagram for Find Modes:

Functions

 KeyStore (String filename, int idxLength) throws IOException,CryptoServerException
 Opens the given key store database or creates it if not existing. More...
 
 KeyStore (CryptoServerConfig config, int idxLength) throws IOException,CryptoServerException
 Opens the given key store database or creates it if not existing. More...
 
int getIndexLength () throws CryptoServerException
 Returns the index (search key) length of the database.
 
boolean findKey (byte[] startIndex, int mode, KeyAttributes attributes) throws CryptoServerException
 Finds a key with the given attributes. More...
 
Key getKey (byte[] index) throws CryptoServerException
 Returns the key with the given index. More...
 
byte[] insertKey (int flags, byte[] index, Key key) throws CryptoServerException
 Inserts a key into the key store. More...
 
void deleteKey (byte[] index) throws CryptoServerException
 Deletes the key with the given index. More...
 
 ByteArray ()
 Creates an empty byte array.
 
 ByteArray (byte[] val)
 Creates a new byte array of same length and content as val. More...
 
void setBytes (byte[] val)
 Sets content of byte array. More...
 
byte[] getBytes ()
 Returns reference to content of byte array. More...
 
int length ()
 Returns length of byte array. More...
 
void setInt (int val)
 Sets content to 4-byte big endian representation of given integer. More...
 
int getInt ()
 Returns value of the integer stored as 4 bytes in big endian representation. More...
 
void append (byte[] val)
 Appends byte[] data to byte array. More...
 
void append (ByteArray val)
 Appends content of another ByteArray to this byte array. More...
 
void appendInt2 (int val)
 Appends an integer to byte array, encoded in 2 bytes big-endian representation. More...
 
void appendInt4 (int val)
 Appends an integer to byte array, encoded in 4 bytes big-endian representation. More...
 
void clear ()
 Clears byte array completely.
 

Variables

static final int MODE_EQUAL = 0
 search the key with exactly the given index
 
static final int MODE_GTEQ = 1
 search key with exactly the given index or the next greater index
 
static final int MODE_GREATER = 2
 search key with the next greater index
 

Detailed Description

Function Documentation

◆ KeyStore() [1/2]

KeyStore ( String  filename,
int  idxLength 
) throws IOException,CryptoServerException

Opens the given key store database or creates it if not existing.

Parameters
filenamefilename (including path) of key store database.
idxLengthsize of database index. The maximum size of the database index is 100.
Note
the database index size is set on database creation and can't be changed later.

◆ KeyStore() [2/2]

KeyStore ( CryptoServerConfig  config,
int  idxLength 
) throws IOException,CryptoServerException

Opens the given key store database or creates it if not existing.

Parameters
configConfiguration object. The following key names will be recognized:

Value Mandatory Default Value Description
KeyStore Yes - filename (including path) of key store database. Use forward slashes as path separator (even on Windows).

idxLengthsize of database index. The maximum size of the database index is 100.
Note
the database index size is set on database creation and can't be changed later.

◆ findKey()

boolean findKey ( byte[]  startIndex,
int  mode,
KeyAttributes  attributes 
) throws CryptoServerException

Finds a key with the given attributes.

Call the function multiple times to list all keys (with the desired attributes).

Parameters
startIndexIndex to start search.
modeSearch mode (see Find Modes):
  • MODE_EQUAL - search the key with exactly the given index
  • MODE_GTEQ - search key with exactly the given index or the next greater index
  • MODE_GREATER - search key with the next greater index
attributesOptional list of attributes the desired key should match.
Returns
true if database entry was found, otherwise false.

◆ getKey()

Key getKey ( byte[]  index) throws CryptoServerException

Returns the key with the given index.

Parameters
indexIndex of key to be retrieved.
Returns
Desired key
Exceptions
CryptoServerExceptionif the key with the given index was not found.

◆ insertKey()

byte[] insertKey ( int  flags,
byte[]  index,
Key  key 
) throws CryptoServerException

Inserts a key into the key store.

The key will be stored under the given index.

Parameters
flagsFLAG_OVERWRITE, if an existing key should be overwritten.
indexDatabase index for the key to be inserted. If the index value is null, the first unused index will be used.
keyKey to be inserted.
Returns
actual index (worth knowing especially in case of null as input).

◆ deleteKey()

void deleteKey ( byte[]  index) throws CryptoServerException

Deletes the key with the given index.

Parameters
indexIndex of key to be deleted.
Exceptions
CryptoServerExceptionif the key with the given index was not found.

◆ ByteArray()

ByteArray ( byte[]  val)

Creates a new byte array of same length and content as val.

Parameters
valIs copied as initial content of new byte array.

◆ setBytes()

void setBytes ( byte[]  val)

Sets content of byte array.

Parameters
valIs copied as new content of byte array.

◆ getBytes()

byte[] getBytes ( )

Returns reference to content of byte array.

Returns
byte[] reference to original content.

◆ length()

int length ( )

Returns length of byte array.

Returns
length of byte array

◆ setInt()

void setInt ( int  val)

Sets content to 4-byte big endian representation of given integer.

Parameters
valNew integer value

◆ getInt()

int getInt ( )

Returns value of the integer stored as 4 bytes in big endian representation.

Returns 0 if the byte array is NOT 4 bytes in length.

Returns
Integer value of first 4 bytes (big endian)

◆ append() [1/2]

void append ( byte[]  val)

Appends byte[] data to byte array.

Parameters
valByte data to be appended to array.

◆ append() [2/2]

void append ( ByteArray  val)

Appends content of another ByteArray to this byte array.

Parameters
valByteArray to be appended to array.

◆ appendInt2()

void appendInt2 ( int  val)

Appends an integer to byte array, encoded in 2 bytes big-endian representation.

Parameters
valInteger value to be appended to array.

◆ appendInt4()

void appendInt4 ( int  val)

Appends an integer to byte array, encoded in 4 bytes big-endian representation.

Parameters
valInteger value to be appended to array.