📄 pkcs11implementation.java
字号:
*/ public native long C_OpenSession(long slotID, long flags, Object pApplication, CK_NOTIFY Notify) throws PKCS11Exception; /** * C_CloseSession closes a session between an application and a * token. * (Session management) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native void C_CloseSession(long hSession) throws PKCS11Exception; /** * C_CloseAllSessions closes all sessions with a token. * (Session management) * * @param slotID the ID of the token's slot * (PKCS#11 param: CK_SLOT_ID slotID) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native void C_CloseAllSessions(long slotID) throws PKCS11Exception; /** * C_GetSessionInfo obtains information about the session. * (Session management) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @return the session info * (PKCS#11 param: CK_SESSION_INFO_PTR pInfo) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions (result <> null) */ public native CK_SESSION_INFO C_GetSessionInfo(long hSession) throws PKCS11Exception; /** * C_GetOperationState obtains the state of the cryptographic operation * in a session. * (Session management) * * @param hSession session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @return the state and the state length * (PKCS#11 param: CK_BYTE_PTR pOperationState, * CK_ULONG_PTR pulOperationStateLen) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions (result <> null) */ public native byte[] C_GetOperationState(long hSession) throws PKCS11Exception; /** * C_SetOperationState restores the state of the cryptographic * operation in a session. * (Session management) * * @param hSession session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param pOperationState the state and the state length * (PKCS#11 param: CK_BYTE_PTR pOperationState, * CK_ULONG ulOperationStateLen) * @param hEncryptionKey en/decryption key * (PKCS#11 param: CK_OBJECT_HANDLE hEncryptionKey) * @param hAuthenticationKey sign/verify key * (PKCS#11 param: CK_OBJECT_HANDLE hAuthenticationKey) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native void C_SetOperationState(long hSession, byte[] pOperationState, long hEncryptionKey, long hAuthenticationKey) throws PKCS11Exception; /** * C_Login logs a user into a token. * (Session management) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param userType the user type * (PKCS#11 param: CK_USER_TYPE userType) * @param pPin the user's PIN and the length of the PIN * (PKCS#11 param: CK_CHAR_PTR pPin, CK_ULONG ulPinLen) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native void C_Login(long hSession, long userType, char[] pPin) throws PKCS11Exception; /** * C_Logout logs a user out from a token. * (Session management) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native void C_Logout(long hSession) throws PKCS11Exception;/* ***************************************************************************** * Object management ******************************************************************************/ /** * C_CreateObject creates a new object. * (Object management) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param pTemplate the object's template and number of attributes in * template * (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) * @return the object's handle * (PKCS#11 param: CK_OBJECT_HANDLE_PTR phObject) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native long C_CreateObject(long hSession, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; /** * C_CopyObject copies an object, creating a new object for the * copy. * (Object management) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param hObject the object's handle * (PKCS#11 param: CK_OBJECT_HANDLE hObject) * @param pTemplate the template for the new object and number of attributes * in template * (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) * @return the handle of the copy * (PKCS#11 param: CK_OBJECT_HANDLE_PTR phNewObject) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native long C_CopyObject(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; /** * C_DestroyObject destroys an object. * (Object management) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param hObject the object's handle * (PKCS#11 param: CK_OBJECT_HANDLE hObject) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native void C_DestroyObject(long hSession, long hObject) throws PKCS11Exception; /** * C_GetObjectSize gets the size of an object in bytes. * (Object management) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param hObject the object's handle * (PKCS#11 param: CK_OBJECT_HANDLE hObject) * @return the size of the object * (PKCS#11 param: CK_ULONG_PTR pulSize) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native long C_GetObjectSize(long hSession, long hObject) throws PKCS11Exception; /** * C_GetAttributeValue obtains the value of one or more object * attributes. The template attributes also receive the values. * (Object management) * note: in PKCS#11 pTemplate and the result template are the same * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param hObject the object's handle * (PKCS#11 param: CK_OBJECT_HANDLE hObject) * @param pTemplate 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) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions (pTemplate <> null) * @postconditions (result <> null) */ public native void C_GetAttributeValue(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; /** * C_SetAttributeValue modifies the value of one or more object * attributes * (Object management) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param hObject the object's handle * (PKCS#11 param: CK_OBJECT_HANDLE hObject) * @param pTemplate specifies the attributes and values to get; number of * attributes in the template * (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions (pTemplate <> null) * @postconditions */ public native void C_SetAttributeValue(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; /** * C_FindObjectsInit initializes a search for token and session * objects that match a template. * (Object management) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param pTemplate 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) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native void C_FindObjectsInit(long hSession, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; /** * C_FindObjects continues a search for token and session * objects that match a template, obtaining additional object * handles. * (Object management) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param ulMaxObjectCount the max. object handles to get * (PKCS#11 param: CK_ULONG ulMaxObjectCount) * @return the object's handles and the actual number of objects returned * (PKCS#11 param: CK_ULONG_PTR pulObjectCount) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions (result <> null) */ public native long[] C_FindObjects(long hSession, long ulMaxObjectCount) throws PKCS11Exception; /** * C_FindObjectsFinal finishes a search for token and session * objects. * (Object management) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native void C_FindObjectsFinal(long hSession) throws PKCS11Exception;/* ***************************************************************************** * Encryption and decryption ******************************************************************************/ /** * C_EncryptInit initializes an encryption operation. * (Encryption and decryption) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param pMechanism the encryption mechanism * (PKCS#11 param: CK_MECHANISM_PTR pMechanism) * @param hKey the handle of the encryption key * (PKCS#11 param: CK_OBJECT_HANDLE hKey) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native void C_EncryptInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception; /** * C_Encrypt encrypts single-part data. * (Encryption and decryption) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param pData the data to get encrypted and the data's length * (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG ulDataLen) * @return the encrypted data and the encrypted data's length * (PKCS#11 param: CK_BYTE_PTR pEncryptedData, * CK_ULONG_PTR pulEncryptedDataLen) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions (pData <> null) * @postconditions (result <> null) */ public native byte[] C_Encrypt(long hSession, byte[] pData) throws PKCS11Exception; /** * C_EncryptUpdate continues a multiple-part encryption * operation. * (Encryption and decryption) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param pPart the data part to get encrypted and the data part's length * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen) * @return the encrypted data part and the encrypted data part's length * (PKCS#11 param: CK_BYTE_PTR pEncryptedPart, CK_ULONG_PTR pulEncryptedPartLen) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions (pPart <> null) * @postconditions */ public native byte[] C_EncryptUpdate(long hSession, byte[] pPart) throws PKCS11Exception; /** * C_EncryptFinal finishes a multiple-part encryption * operation. * (Encryption and decryption) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @return the last encrypted data part and the last data part's length * (PKCS#11 param: CK_BYTE_PTR pLastEncryptedPart, CK_ULONG_PTR pulLastEncryptedPartLen) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions (result <> null) */ public native byte[] C_EncryptFinal(long hSession) throws PKCS11Exception; /** * C_DecryptInit initializes a decryption operation. * (Encryption and decryption) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param pMechanism the decryption mechanism * (PKCS#11 param: CK_MECHANISM_PTR pMechanism) * @param hKey the handle of the decryption key * (PKCS#11 param: CK_OBJECT_HANDLE hKey) * @exception PKCS11Exception If function returns other value than CKR_OK. * @preconditions * @postconditions */ public native void C_DecryptInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception; /** * C_Decrypt decrypts encrypted data in a single part. * (Encryption and decryption) * * @param hSession the session's handle * (PKCS#11 param: CK_SESSION_HANDLE hSession) * @param pEncryptedData the encrypted data to get decrypted and the * encrypted data's length * (PKCS#11 param: CK_BYTE_PTR pEncryptedData, * CK_ULONG ulEncryptedDataLen)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -