Top Description Inners Fields Constructors Methods
sun.security.pkcs11.wrapper

public Class PKCS11

extends Object
Class Inheritance
Known Direct Subclasses
sun.security.pkcs11.wrapper.PKCS11.SynchronizedPKCS11
Imports
java.io.File, .IOException, java.util.*, java.security.AccessController, .PrivilegedAction, sun.security.util.Debug, sun.security.pkcs11.P11Util

This is the default implementation of the PKCS11 interface. IT connects to the pkcs11wrapper.dll file, which is the native part of this library. The strange and awkward looking initialization was chosen to avoid calling loadLibrary from a static initialization block, because this would complicate the use in applets.
Authors
Karl Scheibelhofer , Martin Schlaeffer

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final Map<String, PKCS11>
private static final String
PKCS11_WRAPPER

The name of the native part of the wrapper; i.e. the filename without the extension (e.g. ".DLL" or ".so").

private final String
pkcs11ModulePath

The PKCS#11 module to connect to.

private long
private final CK_VERSION

Constructor Summary

AccessConstructor and Description
pack-priv
PKCS11(String
the PKCS#11 library path
pkcs11ModulePath
,
String
the method name for retrieving the PKCS#11 function list; may be null if not set in config file
functionList
)

Connects to the PKCS#11 driver given.

Method Summary

Modifier and TypeMethod and Description
public native void
C_CloseSession(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
)

C_CloseSession closes a session between an application and a token.

public native long

Returns:

the handle of the copy (PKCS#11 param: CK_OBJECT_HANDLE_PTR phNewObject)
C_CopyObject
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the object's handle (PKCS#11 param: CK_OBJECT_HANDLE hObject)
hObject
,
CK_ATTRIBUTE[]
the template for the new object and number of attributes in template (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
pTemplate
)

C_CopyObject copies an object, creating a new object for the copy.

public native long

Returns:

the object's handle (PKCS#11 param: CK_OBJECT_HANDLE_PTR phObject)
C_CreateObject
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_ATTRIBUTE[]
the object's template and number of attributes in template (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
pTemplate
)

C_CreateObject creates a new object.

public native int

Returns:

the length of decrypted data (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen)
C_Decrypt
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the address of the to-be-decrypted data
directIn
,
byte[]
buffer containing the to-be-decrypted data
in
,
int
buffer offset of the to-be-decrypted data
inOfs
,
int
length of the to-be-decrypted data (PKCS#11 param: CK_BYTE_PTR pDecryptedData, CK_ULONG ulDecryptedDataLen)
inLen
,
long
the address for the decrypted data
directOut
,
byte[]
buffer for the decrypted data
out
,
int
buffer offset for the decrypted data
outOfs
,
int
buffer size for the decrypted data
outLen
)

C_Decrypt decrypts encrypted data in a single part.

public native int

Returns:

the length of this last part of decrypted data (PKCS#11 param: CK_BYTE_PTR pLastPart, CK_ULONG_PTR pulLastPartLen)
C_DecryptFinal
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the address for the decrypted data
directOut
,
byte[]
buffer for the decrypted data
out
,
int
buffer offset for the decrypted data
outOfs
,
int
buffer size for the decrypted data
outLen
)

C_DecryptFinal finishes a multiple-part decryption operation.

public native void
C_DecryptInit(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the decryption mechanism (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
pMechanism
,
long
the handle of the decryption key (PKCS#11 param: CK_OBJECT_HANDLE hKey)
hKey
)

C_DecryptInit initializes a decryption operation.

public native int

Returns:

the length of decrypted data for this update (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen)
C_DecryptUpdate
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the address of the to-be-decrypted data
directIn
,
byte[]
buffer containing the to-be-decrypted data
in
,
int
buffer offset of the to-be-decrypted data
inOfs
,
int
length of the to-be-decrypted data (PKCS#11 param: CK_BYTE_PTR pDecryptedPart, CK_ULONG ulDecryptedPartLen)
inLen
,
long
the address for the decrypted data
directOut
,
byte[]
buffer for the decrypted data
out
,
int
buffer offset for the decrypted data
outOfs
,
int
buffer size for the decrypted data
outLen
)

C_DecryptUpdate continues a multiple-part decryption operation.

public native long

Returns:

the handle of the derived key (PKCS#11 param: CK_OBJECT_HANDLE_PTR phKey)
C_DeriveKey
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the key derivation mechanism (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
pMechanism
,
long
the handle of the base key (PKCS#11 param: CK_OBJECT_HANDLE hBaseKey)
hBaseKey
,
CK_ATTRIBUTE[]
the template for the new key and the number of attributes in the template (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
pTemplate
)

C_DeriveKey derives a key from a base key, creating a new key object.

public native void
C_DestroyObject(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the object's handle (PKCS#11 param: CK_OBJECT_HANDLE hObject)
hObject
)

C_DestroyObject destroys an object.

public native int

Returns:

the message digest and the length of the message digest (PKCS#11 param: CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen)
C_DigestFinal
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
byte[] pDigest, int digestOfs, int digestLen)

C_DigestFinal finishes a multiple-part message-digesting operation.

public native void
C_DigestInit(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the digesting mechanism (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
pMechanism
)

C_DigestInit initializes a message-digesting operation.

public native void
C_DigestKey(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the handle of the secret key to be digested (PKCS#11 param: CK_OBJECT_HANDLE hKey)
hKey
)

C_DigestKey continues a multi-part message-digesting operation, by digesting the value of a secret key as part of the data already digested.

public native int

Returns:

the message digest and the length of the message digest (PKCS#11 param: CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen)
C_DigestSingle
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the data to get digested and the data's length (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG ulDataLen)
pMechanism
,
byte[] in, int inOfs, int inLen, byte[] digest, int digestOfs, int digestLen)

C_Digest digests data in a single part.

public native void
C_DigestUpdate(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the data to get digested and the data's length (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
directIn
,
byte[] in, int inOfs, int inLen)

C_DigestUpdate continues a multiple-part message-digesting operation.

public native int

Returns:

the length of encrypted data (PKCS#11 param: CK_BYTE_PTR pEncryptedData, CK_ULONG_PTR pulEncryptedDataLen)
C_Encrypt
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the address of the to-be-encrypted data
directIn
,
byte[]
buffer containing the to-be-encrypted data
in
,
int
buffer offset of the to-be-encrypted data
inOfs
,
int
length of the to-be-encrypted data (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG ulDataLen)
inLen
,
long
the address for the encrypted data
directOut
,
byte[]
buffer for the encrypted data
out
,
int
buffer offset for the encrypted data
outOfs
,
int
buffer size for the encrypted data
outLen
)

C_Encrypt encrypts single-part data.

public native int

Returns:

the length of the last part of the encrypted data (PKCS#11 param: CK_BYTE_PTR pLastEncryptedPart, CK_ULONG_PTR pulLastEncryptedPartLen)
C_EncryptFinal
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the address for the encrypted data
directOut
,
byte[]
buffer for the encrypted data
out
,
int
buffer offset for the encrypted data
outOfs
,
int
buffer size for the encrypted data
outLen
)

C_EncryptFinal finishes a multiple-part encryption operation.

public native void
C_EncryptInit(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the encryption mechanism (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
pMechanism
,
long
the handle of the encryption key (PKCS#11 param: CK_OBJECT_HANDLE hKey)
hKey
)

C_EncryptInit initializes an encryption operation.

public native int

Returns:

the length of encrypted data for this update (PKCS#11 param: CK_BYTE_PTR pEncryptedPart, CK_ULONG_PTR pulEncryptedPartLen)
C_EncryptUpdate
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the address of the to-be-encrypted data
directIn
,
byte[]
buffer containing the to-be-encrypted data
in
,
int
buffer offset of the to-be-encrypted data
inOfs
,
int
length of the to-be-encrypted data (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
inLen
,
long
the address for the encrypted data
directOut
,
byte[]
buffer for the encrypted data
out
,
int
buffer offset for the encrypted data
outOfs
,
int
buffer size for the encrypted data
outLen
)

C_EncryptUpdate continues a multiple-part encryption operation.

public native void
C_Finalize(Object
is reserved. Should be NULL_PTR (PKCS#11 param: CK_VOID_PTR pReserved)
pReserved
)

C_Finalize indicates that an application is done with the Cryptoki library (General-purpose)

public native long[]

Returns:

the object's handles and the actual number of objects returned (PKCS#11 param: CK_ULONG_PTR pulObjectCount)
C_FindObjects
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the max. object handles to get (PKCS#11 param: CK_ULONG ulMaxObjectCount)
ulMaxObjectCount
)

C_FindObjects continues a search for token and session objects that match a template, obtaining additional object handles.

public native void
C_FindObjectsFinal(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
)

C_FindObjectsFinal finishes a search for token and session objects.

public native void
C_FindObjectsInit(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_ATTRIBUTE[]
the object's attribute values to match and the number of attributes in search template (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
pTemplate
)

C_FindObjectsInit initializes a search for token and session objects that match a template.

public native long

Returns:

the handle of the new key (PKCS#11 param: CK_OBJECT_HANDLE_PTR phKey)
C_GenerateKey
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the key generation mechanism (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
pMechanism
,
CK_ATTRIBUTE[]
the template for the new key and the number of attributes in the template (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
pTemplate
)

C_GenerateKey generates a secret key, creating a new key object.

public native long[]

Returns:

a long array with exactly two elements and the public key handle as the first element and the private key handle as the second element (PKCS#11 param: CK_OBJECT_HANDLE_PTR phPublicKey, CK_OBJECT_HANDLE_PTR phPrivateKey)
C_GenerateKeyPair
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the key generation mechanism (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
pMechanism
,
CK_ATTRIBUTE[]
the template for the new public key and the number of attributes in the template (PKCS#11 param: CK_ATTRIBUTE_PTR pPublicKeyTemplate, CK_ULONG ulPublicKeyAttributeCount)
pPublicKeyTemplate
,
CK_ATTRIBUTE[]
the template for the new private key and the number of attributes in the template (PKCS#11 param: CK_ATTRIBUTE_PTR pPrivateKeyTemplate CK_ULONG ulPrivateKeyAttributeCount)
pPrivateKeyTemplate
)

C_GenerateKeyPair generates a public-key/private-key pair, creating new key objects.

public native void
C_GenerateRandom(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
byte[]
receives the random data and the length of RandomData is the length of random data to be generated (PKCS#11 param: CK_BYTE_PTR pRandomData, CK_ULONG ulRandomLen)
randomData
)

C_GenerateRandom generates random data.

public native void
C_GetAttributeValue(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the object's handle (PKCS#11 param: CK_OBJECT_HANDLE hObject)
hObject
,
CK_ATTRIBUTE[]
specifies the attributes and number of attributes to get The template attributes also receive the values. (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
pTemplate
)

C_GetAttributeValue obtains the value of one or more object attributes.

public native CK_INFO

Returns:

the information. (PKCS#11 param: CK_INFO_PTR pInfo)
C_GetInfo
()

C_GetInfo returns general information about Cryptoki.

public native CK_MECHANISM_INFO

Returns:

the mechanism info (PKCS#11 param: CK_MECHANISM_INFO_PTR pInfo)
C_GetMechanismInfo
(long
ID of the token's slot (PKCS#11 param: CK_SLOT_ID slotID)
slotID
,
long
type of mechanism (PKCS#11 param: CK_MECHANISM_TYPE type)
type
)

C_GetMechanismInfo obtains information about a particular mechanism possibly supported by a token.

public native long[]

Returns:

a long array of mechanism types and number of mechanism types (PKCS#11 param: CK_MECHANISM_TYPE_PTR pMechanismList, CK_ULONG_PTR pulCount)
C_GetMechanismList
(long
ID of the token's slot (PKCS#11 param: CK_SLOT_ID slotID)
slotID
)

C_GetMechanismList obtains a list of mechanism types supported by a token.

public native byte[]

Returns:

the state and the state length (PKCS#11 param: CK_BYTE_PTR pOperationState, CK_ULONG_PTR pulOperationStateLen)
C_GetOperationState
(long
session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
)

C_GetOperationState obtains the state of the cryptographic operation in a session.

public native CK_SESSION_INFO

Returns:

the session info (PKCS#11 param: CK_SESSION_INFO_PTR pInfo)
C_GetSessionInfo
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
)

C_GetSessionInfo obtains information about the session.

public native CK_SLOT_INFO

Returns:

the slot information (PKCS#11 param: CK_SLOT_INFO_PTR pInfo)
C_GetSlotInfo
(long
the ID of the slot (PKCS#11 param: CK_SLOT_ID slotID)
slotID
)

C_GetSlotInfo obtains information about a particular slot in the system.

public native long[]

Returns:

a long array of slot IDs and number of Slot IDs (PKCS#11 param: CK_SLOT_ID_PTR pSlotList, CK_ULONG_PTR pulCount)
C_GetSlotList
(boolean
if true only Slot IDs with a token are returned (PKCS#11 param: CK_BBOOL tokenPresent)
tokenPresent
)

C_GetSlotList obtains a list of slots in the system.

public native CK_TOKEN_INFO

Returns:

the token information (PKCS#11 param: CK_TOKEN_INFO_PTR pInfo)
C_GetTokenInfo
(long
ID of the token's slot (PKCS#11 param: CK_SLOT_ID slotID)
slotID
)

C_GetTokenInfo obtains information about a particular token in the system.

pack-priv native void
C_Initialize(Object
if pInitArgs is not NULL it gets casted to CK_C_INITIALIZE_ARGS_PTR and dereferenced (PKCS#11 param: CK_VOID_PTR pInitArgs)
pInitArgs
)

C_Initialize initializes the Cryptoki library.

public native void
C_Login(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the user type (PKCS#11 param: CK_USER_TYPE userType)
userType
,
char[]
the user's PIN and the length of the PIN (PKCS#11 param: CK_CHAR_PTR pPin, CK_ULONG ulPinLen)
pPin
)

C_Login logs a user into a token.

public native void
C_Logout(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
)

C_Logout logs a user out from a token.

public native long

Returns:

the session handle (PKCS#11 param: CK_SESSION_HANDLE_PTR phSession)
C_OpenSession
(long
the slot's ID (PKCS#11 param: CK_SLOT_ID slotID)
slotID
,
long
of CK_SESSION_INFO (PKCS#11 param: CK_FLAGS flags)
flags
,
Object
passed to callback (PKCS#11 param: CK_VOID_PTR pApplication)
pApplication
,
CK_NOTIFY
the callback function (PKCS#11 param: CK_NOTIFY Notify)
Notify
)

C_OpenSession opens a session between an application and a token.

public native void
C_SeedRandom(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
byte[]
the seed material and the seed material's length (PKCS#11 param: CK_BYTE_PTR pSeed, CK_ULONG ulSeedLen)
pSeed
)

C_SeedRandom mixes additional seed material into the token's random number generator.

public native void
C_SessionCancel(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
indicates the operations to cancel. (PKCS#11 param: CK_FLAGS flags)
flags
)

C_SessionCancel terminates active session based operations.

public native void
C_SetAttributeValue(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the object's handle (PKCS#11 param: CK_OBJECT_HANDLE hObject)
hObject
,
CK_ATTRIBUTE[]
specifies the attributes and values to get; number of attributes in the template (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
pTemplate
)

C_SetAttributeValue modifies the value of one or more object attributes (Object management)

public native void
C_SetOperationState(long
session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
byte[]
the state and the state length (PKCS#11 param: CK_BYTE_PTR pOperationState, CK_ULONG ulOperationStateLen)
pOperationState
,
long
en/decryption key (PKCS#11 param: CK_OBJECT_HANDLE hEncryptionKey)
hEncryptionKey
,
long
sign/verify key (PKCS#11 param: CK_OBJECT_HANDLE hAuthenticationKey)
hAuthenticationKey
)

C_SetOperationState restores the state of the cryptographic operation in a session.

public native byte[]

Returns:

the signature and the signature's length (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen)
C_Sign
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
byte[]
the data to sign and the data's length (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG ulDataLen)
pData
)

C_Sign signs (encrypts with private key) data in a single part, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.

public native byte[]

Returns:

the signature and the signature's length (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen)
C_SignFinal
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
int
expected signature length, can be 0 if unknown
expectedLen
)

C_SignFinal finishes a multiple-part signature operation, returning the signature.

public native void
C_SignInit(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the signature mechanism (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
pMechanism
,
long
the handle of the signature key (PKCS#11 param: CK_OBJECT_HANDLE hKey)
hKey
)

C_SignInit initializes a signature (private key encryption) operation, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.

public native int

Returns:

the signature and the signature's length (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen)
C_SignRecover
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
byte[]
the data to sign and the data's length (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG ulDataLen)
in
,
int inOfs, int inLen, byte[] out, int outOufs, int outLen)

C_SignRecover signs data in a single operation, where the data can be recovered from the signature.

public native void
C_SignRecoverInit(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the signature mechanism (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
pMechanism
,
long
the handle of the signature key (PKCS#11 param: CK_OBJECT_HANDLE hKey)
hKey
)

C_SignRecoverInit initializes a signature operation, where the data can be recovered from the signature.

public native void
C_SignUpdate(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the data part to sign and the data part's length (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
directIn
,
byte[] in, int inOfs, int inLen)

C_SignUpdate continues a multiple-part signature operation, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.

public native long

Returns:

the handle of the unwrapped key (PKCS#11 param: CK_OBJECT_HANDLE_PTR phKey)
C_UnwrapKey
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the unwrapping mechanism (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
pMechanism
,
long
the handle of the unwrapping key (PKCS#11 param: CK_OBJECT_HANDLE hUnwrappingKey)
hUnwrappingKey
,
byte[]
the wrapped key to unwrap and the wrapped key's length (PKCS#11 param: CK_BYTE_PTR pWrappedKey, CK_ULONG ulWrappedKeyLen)
pWrappedKey
,
CK_ATTRIBUTE[]
the template for the new key and the number of attributes in the template (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
pTemplate
)

C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new key object.

public native void
C_Verify(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
byte[]
the signed data and the signed data's length (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG ulDataLen)
pData
,
byte[]
the signature to verify and the signature's length (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen)
pSignature
)

C_Verify verifies a signature in a single-part operation, where the signature is an appendix to the data, and plaintext cannot be recovered from the signature.

public native void
C_VerifyFinal(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
byte[]
the signature to verify and the signature's length (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen)
pSignature
)

C_VerifyFinal finishes a multiple-part verification operation, checking the signature.

public native void
C_VerifyInit(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the verification mechanism (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
pMechanism
,
long
the handle of the verification key (PKCS#11 param: CK_OBJECT_HANDLE hKey)
hKey
)

C_VerifyInit initializes a verification operation, where the signature is an appendix to the data, and plaintext cannot cannot be recovered from the signature (e.g. DSA).

public native int

Returns:

the recovered data and the recovered data's length (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen)
C_VerifyRecover
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
byte[]
the signature to verify and the signature's length (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen)
in
,
int inOfs, int inLen, byte[] out, int outOufs, int outLen)

C_VerifyRecover verifies a signature in a single-part operation, where the data is recovered from the signature.

public native void
C_VerifyRecoverInit(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the verification mechanism (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
pMechanism
,
long
the handle of the verification key (PKCS#11 param: CK_OBJECT_HANDLE hKey)
hKey
)

C_VerifyRecoverInit initializes a signature verification operation, where the data is recovered from the signature.

public native void
C_VerifyUpdate(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
long
the signed data part and the signed data part's length (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
directIn
,
byte[] in, int inOfs, int inLen)

C_VerifyUpdate continues a multiple-part verification operation, where the signature is an appendix to the data, and plaintext cannot be recovered from the signature.

public native byte[]

Returns:

the wrapped key and the length of the wrapped key (PKCS#11 param: CK_BYTE_PTR pWrappedKey, CK_ULONG_PTR pulWrappedKeyLen)
C_WrapKey
(long
the session's handle (PKCS#11 param: CK_SESSION_HANDLE hSession)
hSession
,
CK_MECHANISM
the wrapping mechanism (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
pMechanism
,
long
the handle of the wrapping key (PKCS#11 param: CK_OBJECT_HANDLE hWrappingKey)
hWrappingKey
,
long
the handle of the key to be wrapped (PKCS#11 param: CK_OBJECT_HANDLE hKey)
hKey
)

C_WrapKey wraps (i.e., encrypts) a key.

private native CK_VERSION

Returns:

the actual PKCS11 interface version
connect
(String
The PKCS#11 library path.
pkcs11ModulePath
,
String
the method name for retrieving the PKCS#11 function list; may be null if not set in config file
functionList
)

Connects this object to the specified PKCS#11 library.

public native long

Returns:

key object handle
createNativeKey
(long
the session's handle
hSession
,
byte[]
opaque byte array containing key object attributes and values
keyInfo
,
long
key handle for unwrapping the extracted sensitive keys. -1 if not used.
hWrappingKey
,
CK_MECHANISM
mechanism for unwrapping the extracted sensitive keys
pWrappingMech
)

createNativeKey creates a key object with attributes and values specified by parameter as an opaque byte array.

private static native void
disconnect(long pNativeData)

Disconnects the PKCS#11 library from this object.

private static native void
finalizeLibrary()

This method does the finalization of the native library.

public static native long
freeMechanism(long hMechanism)

public static synchronized PKCS11
getInstance(String pkcs11ModulePath, String functionList, CK_C_INITIALIZE_ARGS pInitArgs, boolean omitInitialize)

public native byte[]

Returns:

an opaque byte array containing the key object attributes and values
getNativeKeyInfo
(long
the session's handle
hSession
,
long
key's handle
hKey
,
long
key handle for wrapping the extracted sensitive keys. -1 if not used.
hWrappingKey
,
CK_MECHANISM
mechanism for wrapping the extracted sensitive keys
pWrappingMech
)

getNativeKeyInfo gets the key object attributes and values as an opaque byte array to be used in createNativeKey method.

public CK_VERSION
private static native void
initializeLibrary(boolean debug)

This method does the initialization of the native library.

public static void
private static Runnable
releaserFor(long pNativeData)

public String

Returns:

The string representation of object
toString
()

Overrides java.lang.Object.toString.

Returns the string representation of this object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait