Luna Jcprov

Package com.safenetinc.jcprov

Provides access to the API functions, and general structure/class definitions.

See: Description

Package com.safenetinc.jcprov Description

Provides access to the API functions, and general structure/class definitions.

The Cryptoki class provides access to the PKCS#11 API, including any SafeNet, Inc. extensions.

The Cryptoki class tries to stay true to its 'C' API equivalent, in that all functions return an error code instead of throwing exception. In rare cases, a RuntimeException may be thrown by functions from this class (e.g. if a constant object, such as CKK.DES is passed into Cryptoki.C_GetAttributeValue via the attribute template, then an java.lang.UnsupportedOperationException object is thrown, to indicate that modification of a constant is not allowed).

The supporting class, CryptokiEx, provides the same functionality as Cryptoki - except as well as returning an error code, if an error occurs a CKR_Exception object is thrown. This allows the programmer to use normal Java exception programming techniques.

The CKR_Exception class is an excapsulation of a PKCS#11 related return code. Instances of this class are thrown by the CryptokiEx class when a non zero return code is detected.

The LongRef class is used to represent a reference to a long (in 'C' speak, a long*). This class is used by functions which return information via an argument (e.g. Cryptoki.C_Encrypt).

Some classes represent 'C' structures (e.g. CK_DATE), and as such all fields are public. When these classes are used, it is up to the caller to allocate the necessary space for the various fields (e.g. CK_DATE.year). Any constructors which take values for the various fields, do NOT copy the arguments, so

byte[] buffer = new byte[4]; CK_DATE date = new CK_DATE(buffer, buffer, buffer);

will result in the year, month and day fields of the object all referencing the same buffer (which is probably not what is wanted).

Luna Jcprov

Copyright (c) 2025 Thales Group. All rights reserved.