iaik.utils
Class Util

java.lang.Object
  |
  +--iaik.utils.Util

public class Util
extends Object

This class provides some general useful methods.

Version:
File Revision 57

Method Summary
static X509Certificate[] arrangeCertificateChain(X509Certificate[] certArray, boolean topdown)
          Tries to construct a certificate chain from an array of certificates.
static byte[] Base64Decode(byte[] in)
          Decodes a Base64 encoded byte array.
static byte[] Base64Encode(byte[] in)
          Encodes a binary byte array into Base64.
static int[] bubbleSort(int[] a)
          Sort the given array of ints in ascending order and return it.
static long[] bubbleSort(long[] a)
          Sort the given array of longs in ascending order and return it.
static int calculateHashCode(byte[] value)
          Creates an integer suitable for hash table indexing.
static void compareTables(String text, int[] T0, int[] T1)
           
static X509Certificate[] convertCertificateChain(Certificate[] certificateChain)
          This method converts an array of Certificates into an array of X509Certificates.
static byte[] convertEndian32(byte[] in)
          Convert between little and big endian 32 bit formats.
static AttributeCertificate[] convertToAttributeCertificateChain(Certificate[] certificateChain)
          This method converts an array of Certificates into an array of AttributeCertificates.
static void copyStream(InputStream source, OutputStream destination, byte[] buffer)
          Reads all data (until EOF is reached) from the given source to the destination stream.
static byte[] decodeByteArray(String st)
          Decode base64 encoded data from the given string and return it as a byte array.
static int[] decodeIntArray(String st)
          Decode base64 encoded data from the given string and return it as an int array.
static Key decodeKey(int keyType, String keyAlgorithm, byte[] encodedKey)
          Construct a key object from and encoded key.
static String encodeByteArray(byte[] b)
          Encodes a byte array in base64 and return it as a string.
static String encodeIntArray(int[] a)
          Encode an int array in base64 and return it as a string.
static void fillArray(byte[] array, InputStream is)
          This method tries to fill the given array with data read from the InputStream.
static String fromBooleanArray(boolean[] bits)
          Converts the given array of boolean values into a string of zeros and ones.
static int getDigestLength(AlgorithmID hashAlgID)
          Tries to determine the length of the digest value produced by the given hash algorithm.
static int getKeyLength(PrivateKey key)
          Gets the modulus length of a private key.
static int getKeyLength(PublicKey key)
          Gets the modulus length of a public key.
static String getRawCipherName(String transformation)
          Tries to get the raw name of the cipher specified by the given transformation string.
static RSAPrivateKey getRSAPrivateKey(Key key)
          Convert a key to an IAIK RSAPrivateKey.
static RSAPublicKey getRSAPublicKey(Key key)
          Convert a key to an IAIK RSAPublicKey.
static Vector getVector(Object[] array)
          This method converts an array to a Vector.
static boolean loadClass(String name, boolean createInstance)
          Tries to dynamically load a class.
static String printIndented(String msg, boolean indentFirst)
          Creates a new String from the given (multi line) message where each line is indented with a space " " token.
static String printIndented(String msg, boolean indentFirst, String indentToken)
          Creates a new String from the given (multi line) message where each line is indented with the given indent token.
static void printIndented(String msg, boolean indentFirst, StringBuffer buf)
          Prints the given (multi line) message indented to the supplied StringBuffer.
static void printIndented(String msg, boolean indentFirst, String indentToken, StringBuffer buf)
          Prints the given (multi line) message indented to the supplied StringBuffer.
static void printTable(String text, byte[] table)
           
static void printTable(String text, int[] table)
           
static X509Certificate[] readCertificateChain(InputStream is)
          Tries to read a certificate chain from the given input stream.
static X509CRL[] readCRLChain(InputStream is)
          Tries to read a crl list from the given input stream.
static byte[] readFile(String fileName)
          Reads the content of a file into a byte array.
static byte[] readStream(InputStream in)
          Reads the contents of the stream into a byte array.
static byte[] resizeArray(byte[] array, int len)
          Resizes a byte array to the specified length.
static Object[] resizeArray(Object[] array, int len)
          Resizes an array of objects to the specified length.
static void saveToFile(byte[] array, String fileName)
          Saves the content of the given byte array to a file.
static void setEncoding(String encoding)
          Sets the encoding to be used by ASN.1 String types for String - byte conversion.
static Object[] toArray(Vector aVector)
          This method converts a Vector to an array.
static Object[] toArray(Vector aVector, Class cls)
          This method converts a Vector to an array.
static byte[] toASCIIBytes(String s)
          Convert the String to a byte[] in the ASCII encoding.
static String toASCIIString(byte[] bytes)
          Convert the bytes to a String using the ASCII encoding.
static String toASCIIString(byte[] bytes, int ofs, int cnt)
          Convert the bytes to a String using the ASCII encoding.
static boolean[] toBooleanArray(String bits)
          Transforms the characters of the given bit string into boolean values and returns the given string as an array of boolean values.
static int toByte(char c, int radix)
          Convert the given char to an int.
static byte[] toByteArray(String s)
          Convert the given string with hex values to a byte array.
static String toPemString(Certificate cert)
          Convert the given Certificate to a PEM style base64 encoded string.
static String toPemString(CertificateRequest request)
          Convert the given Certificate request to a PEM style base64 encoded string.
static String toPemString(PrivateKey privKey)
          Convert the given private key to a PEM style base64 encoded string.
static String toPemString(X509CRL crl)
          Convert the given CRL to a PEM style base64 encoded string.
static String toString(byte b)
          Converts a byte into a hexadecimal string.
static String toString(byte[] byteArray)
          Converts a byte array into a hexadecimal string of the format: 01:23:34:56...
static String toString(byte[] byteArray, int off, int len)
          Converts the specified subsequence of the given byte array into a hexadecimal string of the format: 01:23:34:56...
static String toString(byte[] byteArray, int off, int len, String delimiter)
          Converts the specified subsequence of the given byte array into a hexadecimal string of the format: 01:23:34:56...
static String toString(byte[] byteArray, String delimiter)
          Converts a byte array into a hexadecimal string of the format: 01:23:34:56...
static String toString(int i)
          Converts an int into a hexadecimal string of the format: 01:23:34:56...
static String toString(long l)
          Converts an int into a hexadecimal string of the format: 01:23:34:56...
static void waitKey()
          Wait for the user to press the return key on System.in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadClass

public static boolean loadClass(String name,
                                boolean createInstance)
Tries to dynamically load a class.

The class to be loaded has to be specified by its name (including the whole package hierachy), e.g.:

 Util.loadClass("iaik.test.testdemo.Test1", true);
 
For actually creating a new instance of the requested class - some implementations of the Java-VM only execute the static part of a class if a new instance is created - set the createInstance parameter to true.
Parameters:
name - the name of the class to load (e.g. "iaik.Test")
createInstance - if set to true a new instance of the specified class is created;
Returns:
true, if the class has been loaded successfully and a new instance has been created (if desired); false otherwise

readFile

public static byte[] readFile(String fileName)
                       throws IOException
Reads the content of a file into a byte array.
Parameters:
fileName - the name of the file to read
Returns:
the content of the file in a byte array
Throws:
IOException - if an IO error occurs

readStream

public static byte[] readStream(InputStream in)
                         throws IOException
Reads the contents of the stream into a byte array. The stream is read until it returns EOF.
Parameters:
in - the input stream to be read
Returns:
the byte array to which the contents of the stream is read
Throws:
IOException - if an error occurs while reading the stream

copyStream

public static void copyStream(InputStream source,
                              OutputStream destination,
                              byte[] buffer)
                       throws IOException
Reads all data (until EOF is reached) from the given source to the destination stream. If the destination stream is null, all data is dropped. It uses the given buffer to read data and forward it. If the buffer is null, this method allocates a buffer.
Parameters:
source - The stream providing the data.
destination - The stream that takes the data. If this is null, all data from source will be read and discarded.
buffer - The buffer to use for forwarding. If it is null, the method allocates a buffer.
Throws:
IOException - If reading from the source or writing to the destination fails.

saveToFile

public static void saveToFile(byte[] array,
                              String fileName)
                       throws IOException
Saves the content of the given byte array to a file.
Parameters:
array - the byte array supplying the data to be written to the file
fileName - the name of the file to which the data shall be written
Throws:
IOException - if an I/O error occurs

toString

public static String toString(byte b)
Converts a byte into a hexadecimal string.

For instance:

 byte b = ...;
 System.out.println(Util.toString(b));
 
Parameters:
b - the byte to convert
Returns:
the byte as hex value

toString

public static String toString(byte[] byteArray,
                              int off,
                              int len)
Converts the specified subsequence of the given byte array into a hexadecimal string of the format: 01:23:34:56... .

Starting at off, len bytes will be converted and returned as hexadecimal string, e.g.:

 byte[] arr = ...;
 System.out.println(Util.toString(arr, 0, 3));
 
Parameters:
byteArray - the byte array containing the data
off - the offset indicating the start position within the given byte array; the following len bytes will be converted into a hexadecimal string
len - how many bytes shall be written
Returns:
the string representation

toString

public static String toString(byte[] byteArray,
                              int off,
                              int len,
                              String delimiter)
Converts the specified subsequence of the given byte array into a hexadecimal string of the format: 01:23:34:56... .

Starting at off, len bytes will be converted and returned as hexadecimal string, e.g.:

 byte[] arr = ...;
 System.out.println(Util.toString(arr, 0, 3));
 
Parameters:
byteArray - the byte array containing the data
off - the offset indicating the start position within the given byte array; the following len bytes will be converted into a hexadecimal string
len - how many bytes shall be written
delimiter - the delimiter to be used for separating the hex values, e.g. ":" (specify "" for not using a delimiter)
Returns:
the string representation

toString

public static String toString(byte[] byteArray)
Converts a byte array into a hexadecimal string of the format: 01:23:34:56... .

For instance:

 byte[] arr = ...;
 System.out.println(Util.toString(arr));
 
Parameters:
byteArray - the byte array containing the data
Returns:
the string representation

toString

public static String toString(byte[] byteArray,
                              String delimiter)
Converts a byte array into a hexadecimal string of the format: 01:23:34:56... .

For instance:

 byte[] arr = ...;
 System.out.println(Util.toString(arr));
 
Parameters:
byteArray - the byte array containing the data
delimiter - the delimiter to be used for separating the hex values, e.g. ":" (specify "" for not using a delimiter)
Returns:
the string representation

toString

public static String toString(int i)
Converts an int into a hexadecimal string of the format: 01:23:34:56... .

For instance:

 int i = ...;
 System.out.println(Util.toString(i));
 
Parameters:
i - the int to convert
Returns:
the int as hexadecimal string representation

toString

public static String toString(long l)
Converts an int into a hexadecimal string of the format: 01:23:34:56... . Uses big endian byte order.

Base64Encode

public static byte[] Base64Encode(byte[] in)
Encodes a binary byte array into Base64.

Base64 is the encoding format used by Multipurpose Internet Mail Extension (Mime) for transmitting non-text material over text-only communications channels. Base64 is based on a 65-character subset of US-ASCII, enabling 6 bits to be represented per printable character (see RFC 1521).

This method may be used for Base64 encoding some already DER encoded ASN1 object to get the PEM (Base64 DER) encoding, e.g.:

 ASN1 asn1 = ...;
 //DER encode the ASN1 data structure just created:
 byte[] der_array = asn1.toByteArray();
 //Base64 encode the DER encoded byte array just created to get the
 //PEM encoding:
 byte[] pem_array = Util.Base64Encode(der_array);
 
Parameters:
in - the binary data to be Base64 encoded
Returns:
the Base64 encoded data

Base64Decode

public static byte[] Base64Decode(byte[] in)
                           throws Base64Exception
Decodes a Base64 encoded byte array.

Base64 is the encoding format used by Multipurpose Internet Mail Extension (Mime) for transmitting non-text material over text-only communications channels. Base64 is based on a 65-character subset of US-ASCII, enabling 6 bits to be represented per printable character (see RFC 1521).

For instance:

 byte[] data = ...;
 byte[] encoded_data = Util.Base64Encode(data);
 byte[] decoded_data = Util.Base64Decode(encoded_data);
 
Parameters:
in - the Base64 encoded data to be decoded
Returns:
the decoded data
Throws:
Base64Exception - if there occurs an error while decoding

resizeArray

public static byte[] resizeArray(byte[] array,
                                 int len)
Resizes a byte array to the specified length.

If len is smaller than the array size some bytes are lost.

Parameters:
array - the array to resize
len - the new length of the array
Returns:
the resized array

resizeArray

public static Object[] resizeArray(Object[] array,
                                   int len)
Resizes an array of objects to the specified length.

If len is smaller than the array size some entries are lost.

Parameters:
array - the array to resize
len - the new length of the array
Returns:
the resized array

fillArray

public static void fillArray(byte[] array,
                             InputStream is)
                      throws IOException
This method tries to fill the given array with data read from the InputStream. This method will not return until the array is full or an exception occurs.
Parameters:
array - the array to fill
is - the InputStream to read from

getVector

public static Vector getVector(Object[] array)
This method converts an array to a Vector.
Parameters:
array - the array to convert
Returns:
the created Vector

toArray

public static Object[] toArray(Vector aVector)
This method converts a Vector to an array. ATTENTION: It is not possible to cast the returned array to an type other than (Object[]). To enable casting use the method: @see toArray(Vector, Class);
Parameters:
aVector - the Vector to convert
Returns:
the created array

toArray

public static Object[] toArray(Vector aVector,
                               Class cls)
This method converts a Vector to an array. This method must be used to get an array of a special type. You need this special type for casting an array.
 AType[] test = (AType[])Util.toArray(aVector, AType.class);
 
Without using the specified class a ClassCastException would occur.
Parameters:
aVector - the Vector to convert
cls - specifies the type of the elements
Returns:
the created array

waitKey

public static void waitKey()
Wait for the user to press the return key on System.in.

toByte

public static int toByte(char c,
                         int radix)
Convert the given char to an int. '0' maps to 0, 'a' and 'A' to 10, 'z' and 'Z' to 36, and so on. For all other characters and for resulting values equal to or larger than radix -1 is returned.

toByteArray

public static byte[] toByteArray(String s)
Convert the given string with hex values to a byte array. For example "001122" is turned into {0, 0x11, 0x22}. All characters outside the range of '0'-'9', 'a'-'z', and 'A'-'Z' or simply ignored.

decodeByteArray

public static byte[] decodeByteArray(String st)
                              throws RuntimeException
Decode base64 encoded data from the given string and return it as a byte array. Base64Exceptions cause a RuntimeException.

encodeByteArray

public static String encodeByteArray(byte[] b)
Encodes a byte array in base64 and return it as a string. It can be decoded again using decodeByteArray.
This method formats a base64 encoded byte array so that the string it represents can be inserted in a Java source code. Use method Base64Encode for getting the raw base64 encoded byte array.
Parameters:
b - the byte array to be encoded

decodeIntArray

public static int[] decodeIntArray(String st)
                            throws RuntimeException
Decode base64 encoded data from the given string and return it as an int array. It must have been encoded MSB first (big endian). Base64Exceptions cause a RuntimeException.

encodeIntArray

public static String encodeIntArray(int[] a)
Encode an int array in base64 and return it as a string. It can be decoded again using decodeIntArray.

fromBooleanArray

public static String fromBooleanArray(boolean[] bits)
Converts the given array of boolean values into a string of zeros and ones.
Parameters:
bits - the array of boolean values to be converted
Returns:
the String representation of the given boolen array

toBooleanArray

public static boolean[] toBooleanArray(String bits)
Transforms the characters of the given bit string into boolean values and returns the given string as an array of boolean values.
Parameters:
bits - the string of bits to be transformed into booleans
Returns:
an array of boolean values representing the characters of the given string of bits

toPemString

public static String toPemString(Certificate cert)
Convert the given Certificate to a PEM style base64 encoded string. The returned string will look something like:
 -----BEGIN CERTIFICATE-----
 BASE64DATA
 -----END CERTIFICATE-----
 
All lines will be terminated by '\n'. In case of a CertificateEncodingException null will be returned (should never occur with the IAIK JCE).

toPemString

public static String toPemString(X509CRL crl)
Convert the given CRL to a PEM style base64 encoded string. The returned string will look something like:
 -----BEGIN CRL-----
 BASE64DATA
 -----END CRL-----
 
All lines will be terminated by '\n'. In case of a CRLException null will be returned (should never occur with the IAIK JCE).

toPemString

public static String toPemString(PrivateKey privKey)
Convert the given private key to a PEM style base64 encoded string. The returned string will look something like:
 -----BEGIN RSA PRIVATE KEY-----
 BASE64DATA
 -----END RSA PRIVATE KEY-----
 
All lines will be terminated by '\n'.

toPemString

public static String toPemString(CertificateRequest request)
Convert the given Certificate request to a PEM style base64 encoded string. The returned string will look something like:
 -----BEGIN NEW CERTIFICATE REQUEST-----
 BASE64DATA
 -----END NEW CERTIFICATE REQUEST-----
 
All lines will be terminated by '\n'.

bubbleSort

public static long[] bubbleSort(long[] a)
Sort the given array of longs in ascending order and return it. This method uses bubble sort which is on average very slow on large array (complexity O(n*n)). However, it is ok to be used on small array, especially if they are 'almost' sorted.

bubbleSort

public static int[] bubbleSort(int[] a)
Sort the given array of ints in ascending order and return it. This method uses bubble sort which is on average very slow on large array (complexity O(n*n)). However, it is ok to be used on small array, especially if they are 'almost' sorted.

convertCertificateChain

public static X509Certificate[] convertCertificateChain(Certificate[] certificateChain)
                                                 throws CertificateException
This method converts an array of Certificates into an array of X509Certificates.
Parameters:
certificateChain - the array of certificates to convert
Returns:
the new certificate chain
Throws:
CertificateException - if there occurs an error while parsing the certificate chain

convertToAttributeCertificateChain

public static AttributeCertificate[] convertToAttributeCertificateChain(Certificate[] certificateChain)
                                                                 throws CertificateException
This method converts an array of Certificates into an array of AttributeCertificates.
Parameters:
certificateChain - the array of certificates to convert
Returns:
the new AttributeCertificate chain
Throws:
CertificateException - if there occurs an error while parsing the certificate chain

arrangeCertificateChain

public static X509Certificate[] arrangeCertificateChain(X509Certificate[] certArray,
                                                        boolean topdown)
Tries to construct a certificate chain from an array of certificates. If a certificate chain that contains all certificates from the array can be build the new certificate chain is returned. Otherwise null is returned. This method builds the chain by checking issuer and subject and testing the signatures.
Parameters:
certArray - an array of certificates
topdown - if true the certificate chain will be returned with the top-CA-certificate at index 0, otherwise with the top-CA-certificate at the array's last index.
Returns:
the rearranged certificate chain or null if the array did not contain a certificate chain.

readCertificateChain

public static X509Certificate[] readCertificateChain(InputStream is)
                                              throws IOException
Tries to read a certificate chain from the given input stream. The input stream is expected to supply a chain of DER encoded X.509 certificates.
Parameters:
is - the inputstream supplying the certificates
Returns:
the certificate chain parsed from the stream
Throws:
IOException - if an error occurs while reading/parsing the chain

readCRLChain

public static X509CRL[] readCRLChain(InputStream is)
                              throws IOException
Tries to read a crl list from the given input stream. The input stream is expected to supply a list of DER encoded X.509 crls.
Parameters:
is - the inputstream supplying the crls
Returns:
the crl list parsed from the stream
Throws:
IOException - if an error occurs while reading/parsing the chain

convertEndian32

public static byte[] convertEndian32(byte[] in)
Convert between little and big endian 32 bit formats.

setEncoding

public static void setEncoding(String encoding)
Sets the encoding to be used by ASN.1 String types for String - byte conversion. This method may used to direct the ASN.1 String types (except UTF8String which is handled differently) to use another encoding scheme than "ASCII", "Cp1252", "ISO8859_1" or "Default".
Parameters:
encoding - the encoding to be used

toASCIIString

public static String toASCIIString(byte[] bytes,
                                   int ofs,
                                   int cnt)
Convert the bytes to a String using the ASCII encoding.

toASCIIString

public static String toASCIIString(byte[] bytes)
Convert the bytes to a String using the ASCII encoding.

toASCIIBytes

public static byte[] toASCIIBytes(String s)
Convert the String to a byte[] in the ASCII encoding.

compareTables

public static void compareTables(String text,
                                 int[] T0,
                                 int[] T1)

printTable

public static void printTable(String text,
                              byte[] table)

printTable

public static void printTable(String text,
                              int[] table)

calculateHashCode

public static int calculateHashCode(byte[] value)
Creates an integer suitable for hash table indexing.
Parameters:
value - the byte array for which a hash code shall be computed
Returns:
a hash code for the given byte array

decodeKey

public static Key decodeKey(int keyType,
                            String keyAlgorithm,
                            byte[] encodedKey)
                     throws NoSuchAlgorithmException,
                            InvalidKeyException
Construct a key object from and encoded key. This method in used internally in the Cipher.unwrap() key method but could also be used by applications. keyType must be one of the key types defined in the Cipher class (private, public, or secret key) and key algorithm the name of the algorithm.

getRSAPublicKey

public static RSAPublicKey getRSAPublicKey(Key key)
                                    throws InvalidKeyException
Convert a key to an IAIK RSAPublicKey. Key must be either an instance of either iaik.security.rsa.RSAPublicKey, java.security.interfaces.RSAPublicKey, or java.security.PublicKey.

getRSAPrivateKey

public static RSAPrivateKey getRSAPrivateKey(Key key)
                                      throws InvalidKeyException
Convert a key to an IAIK RSAPrivateKey. Key must be either an instance of either iaik.security.rsa.RSAPrivateKey, java.security.interfaces.RSAPrivateKey, or java.security.PrivateKey.

getKeyLength

public static int getKeyLength(PublicKey key)
Gets the modulus length of a public key. Supports RSAPublicKey, DSAPublicKey and DHPublicKey.
Parameters:
key - the public key
Returns:
the length of the modulus of the specified key or -1 if key is of an unkonwn subtype of PublicKey

getKeyLength

public static int getKeyLength(PrivateKey key)
Gets the modulus length of a private key. Supports RSAPrivateKey, DSAPrivateKey and DHPrivateKey.
Parameters:
key - the private key
Returns:
the length of the modulus of the specified key or -1 if key is of an unkonwn subtype of PrivateKey

getDigestLength

public static int getDigestLength(AlgorithmID hashAlgID)
Tries to determine the length of the digest value produced by the given hash algorithm.
Parameters:
hashAlgID - the algorithm id of the hash algorithm for which to determine the digest value length
Returns:
the length of the digest value produced by the given hash algorithm, or 0 if the digest length cannot be determined

getRawCipherName

public static String getRawCipherName(String transformation)
Tries to get the raw name of the cipher specified by the given transformation string.

Returns:
the raw name name of the cipher with the given transformation string, e.g. "DES" for transformation "DES/CBC/PKC5Padding"

printIndented

public static String printIndented(String msg,
                                   boolean indentFirst)
Creates a new String from the given (multi line) message where each line is indented with a space " " token.
Parameters:
msg - the (multi line) message to be printed
Returns:
the new String

printIndented

public static String printIndented(String msg,
                                   boolean indentFirst,
                                   String indentToken)
Creates a new String from the given (multi line) message where each line is indented with the given indent token.
Parameters:
msg - the (multi line) message to be printed
indentFirst - whether to indent the first line or leave it unindented
indentToken - the token which shall be printed in front of each line
Returns:
the new String

printIndented

public static void printIndented(String msg,
                                 boolean indentFirst,
                                 StringBuffer buf)
Prints the given (multi line) message indented to the supplied StringBuffer. If the message consists of serveral lines each line is printed indented with the space " " token.
Parameters:
msg - the (multi line) message to be printed
indentFirst - whether to indent the first line or leave it unindented
buf - the StringBuffer to which to print the message

printIndented

public static void printIndented(String msg,
                                 boolean indentFirst,
                                 String indentToken,
                                 StringBuffer buf)
Prints the given (multi line) message indented to the supplied StringBuffer. If the message consists of serveral lines each line is printed indented with the given indent token.
Parameters:
msg - the (multi line) message to be printed
indentFirst - whether to indent the first line or leave it unindented
indentToken - the token which shall be printed in front of each line
buf - the StringBuffer to which to print the message

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK