CXI
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
CryptoServerUtil Class Reference

This class implements as set of utility functions. More...

Static Public Member Functions

static void store_int2 (int val, byte[] buf, int pos)
 <> More...
 
static void store_int3 (int val, byte[] buf, int pos)
 <> More...
 
static void store_int4 (int val, byte[] buf, int pos)
 <> More...
 
static int load_int2 (byte[] buf, int pos)
 <> More...
 
static int load_int3 (byte[] buf, int pos)
 <> More...
 
static int load_int4 (byte[] buf, int pos)
 <> More...
 
static byte[] concat (byte[] a, byte[] b)
 <> More...
 
static byte[] copyOf (byte[] a, int ofs, int len)
 <> More...
 
static byte[] lstrip (byte[] a, int c)
 <> More...
 
static void xtrace (PrintStream out, String str, byte[] data)
 <> More...
 
static void xtrace (PrintStream out, byte[] data)
 <> More...
 
static void xtrace (String str, byte[] data)
 <> More...
 
static void xtrace (byte[] data)
 <> More...
 

Detailed Description

This class implements as set of utility functions.

Some of the static methods may be useful for applications that work with the CryptoServer.

Member Function Documentation

◆ store_int2()

static void store_int2 ( int  val,
byte[]  buf,
int  pos 
)
static

<>

Stores a 2-byte integer in to byte stream. The integer is stored in big endian order.

Parameters
valInteger value to be stored (unsigned).
bufByte array into which the integer is stored.
posPosition in the array (index), where the interger is stored.

◆ store_int3()

static void store_int3 ( int  val,
byte[]  buf,
int  pos 
)
static

<>

Stores a 3-byte integer in to byte stream. The integer is stored in big endian order.

Parameters
valInteger value to be stored (unsigned).
bufByte array into which the integer is stored.
posPosition in the array (index), where the interger is stored.

◆ store_int4()

static void store_int4 ( int  val,
byte[]  buf,
int  pos 
)
static

<>

Stores a 4-byte integer in to byte stream. The integer is stored in big endian order.

Parameters
valInteger value to be stored (unsigned).
bufByte array into which the integer is stored.
posPosition in the array (index), where the interger is stored.

◆ load_int2()

static int load_int2 ( byte[]  buf,
int  pos 
)
static

<>

Loads a 2-byte integer from a byte stream. The integer must be stored in big endian order.

Parameters
bufByte array from which the integer is loaded.
posPosition in the array (index), where the interger is loaded.
Returns
Integer value loaded (unsigned).

◆ load_int3()

static int load_int3 ( byte[]  buf,
int  pos 
)
static

<>

Loads a 3-byte integer from a byte stream. The integer must be stored in big endian order.

Parameters
bufByte array from which the integer is loaded.
posPosition in the array (index), where the interger is loaded.
Returns
Integer value loaded (unsigned).

◆ load_int4()

static int load_int4 ( byte[]  buf,
int  pos 
)
static

<>

Loads a 4-byte integer from a byte stream. The integer must be stored in big endian order.

Parameters
bufByte array from which the integer is loaded.
posPosition in the array (index), where the interger is loaded.
Returns
Integer value loaded.

◆ concat()

static byte[] concat ( byte[]  a,
byte[]  b 
)
static

<>

Concatenates two byte arrays

Parameters
afirst byte array
bsecond byte array
Returns
concatenated arrays (a | b)

◆ copyOf()

static byte[] copyOf ( byte[]  a,
int  ofs,
int  len 
)
static

<>

Returns part of a byte array

Parameters
aoriginal byte array
ofsoffset to copied area
lennumber of bytes to be copied
Returns
byte array containing the copied area

◆ lstrip()

static byte[] lstrip ( byte[]  a,
int  c 
)
static

<>

Strips leading characters from the given byte array

Parameters
abyte array to be stripped
ccharacter to be stripped
Returns
stripped byte array

◆ xtrace() [1/4]

static void xtrace ( PrintStream  out,
String  str,
byte[]  data 
)
static

<>

Prints the contents of a byte array. The byte array is printed hexadecimal and ASCII to a given PrintStream.

Parameters
outPrintStream to which the output is send.
strHeadline for the output.
dataByte array to be printed.

◆ xtrace() [2/4]

static void xtrace ( PrintStream  out,
byte[]  data 
)
static

<>

Prints the contents of a byte array. The byte array is printed hexadecimal and ASCII to a given PrintStream.

Parameters
outPrintStream to which the output is send.
dataByte array to be printed.

◆ xtrace() [3/4]

static void xtrace ( String  str,
byte[]  data 
)
static

<>

Prints the contents of a byte array. The byte array is printed hexadecimal and ASCII to System.out.

Parameters
strHeadline for the output.
dataByte array to be printed.

◆ xtrace() [4/4]

static void xtrace ( byte[]  data)
static

<>

Prints the contents of a byte array. The byte array is printed hexadecimal and ASCII to System.out.

Parameters
dataByte array to be printed.