Sign/Verify operations¶
Contents
Sign¶
-
pypkcs11.sign_verify.
c_sign
(h_session, h_key, data_to_sign, mechanism, output_buffer=None)¶ Signs the given data with given key and mechanism.
Note
If data is a list or tuple of strings, multi-part operations will be used.
Parameters: - h_session (int) – Session handle
- data_to_sign –
The data to sign, either a string or a list of strings. If this is a list a multipart operation will be used.
ex:
- ”This is a proper argument of some data to use in the function”
- [“This is another format of data this”, “function will accept.”, “It will operate on these strings in parts”]
- h_key (int) – The signing key
- mechanism – See the
parse_mechanism()
function for possible values. - output_buffer (list|int) – Integer or list of integers that specify a size of output buffer to use for an operation. By default will query with NULL pointer buffer to get required size of buffer.
Returns: (retcode, python string of signed data)
Return type: tuple
Verify¶
-
pypkcs11.sign_verify.
c_verify
(h_session, h_key, data_to_verify, signature, mechanism)¶ Verifies data with the given signature, key and mechanism.
Note
If data is a list or tuple of strings, multi-part operations will be used.
Parameters: - h_session (int) – Session handle
- data_to_verify –
The data to sign, either a string or a list of strings. If this is a list a multipart operation will be used.
ex:
- ”This is a proper argument of some data to use in the function”
- [“This is another format of data this”, “function will accept.”, “It will operate on these strings in parts”]
- signature (bytes) – Signature with which to verify the data.
- h_key (int) – The verifying key
- mechanism – See the
parse_mechanism()
function for possible values.
Returns: retcode of verify operation