API

Index

bit-and bit-lshift bit-or bit-rshift close-all-sessions close-session copy-object create-object decrypt decrypt-digest-update decrypt-final decrypt-init decrypt-update decrypt-verify-update derive-key destroy-object digest digest-encrypt-update digest-final digest-init digest-key digest-update encrypt encrypt-final encrypt-init encrypt-update find-objects find-objects-final find-objects-init generate-key generate-key-pair generate-random get-attribute-value get-info get-mechanism-info get-mechanism-list get-object-size get-operation-state get-session-info get-slot-info get-slot-list get-token-info hex-decode hex-encode init-pin init-token login logout new open-session seed-random set-attribute-value set-pin sign sign-encrypt-update sign-final sign-init sign-recover sign-recover-init sign-update unwrap-key verify verify-final verify-init verify-recover verify-recover-init verify-update wait-for-slot-event wrap-key

Reference

bit-andcfunction
src/utils.c at line 11, column 1
(bit-and & xs)

Returns the bit-wise and of 64 bit integer xs.

bit-lshiftcfunction
src/utils.c at line 41, column 1
(bit-lshift x shift)

Returns the value of `x` bit shifted left by `shift`. Each elements are 64 bit integers.

bit-orcfunction
src/utils.c at line 26, column 1
(bit-or & xs)

Returns the bit-wise or of 64 bit integer xs.

bit-rshiftcfunction
src/utils.c at line 54, column 1
(bit-rshift x shift)

Returns the value of `x` bit shifted right by `shift`. Each elements are 64 bit integers.

close-all-sessionscfunction
src/session.c at line 162, column 1
(close-all-sessions p11-obj slot-id)

Closes all sessions an application has with a token.

close-sessioncfunction
src/session.c at line 150, column 1
(close-session session-obj)

Closes a session between an application and a token.

copy-objectcfunction
src/object.c at line 31, column 1
(copy-object session-obj obj-handle template)

Copies an object. Returns new `obj-handle`(number), if successful.

create-objectcfunction
src/object.c at line 11, column 1
(create-object session-obj template)

Creates a new object. Returns `obj-handle`(number), if successful.

decryptcfunction
src/decrypt.c at line 31, column 1
(decrypt session-obj data)

Decrypts encrypted data in a single part. Returns an decrypted data in string, if successful.

decrypt-digest-updatecfunction
src/dual.c at line 39, column 1
(decrypt-digest-update session-obj data)

continues a multiple-part combined decryption and digest operation, processing another data part. Returns a recovered data in string, if successful.

decrypt-finalcfunction
src/decrypt.c at line 87, column 1
(decrypt-final session-obj)

Finishes a multiple-part decryption operation. Return the last recovered data part in string, if successful.

decrypt-initcfunction
src/decrypt.c at line 11, column 1
(decrypt-init session-obj mechanism key-handle)

Initializes an decryption operation. Returns a `session-obj`, if successful.

decrypt-updatecfunction
src/decrypt.c at line 58, column 1
(decrypt-update session-obj data)

Continues a multiple-part decryption operation, processing another encrypted `data` part. Return the decrypted data part in string, if successful.

decrypt-verify-updatecfunction
src/dual.c at line 97, column 1
(decrypt-verify-update session-obj data)

continues a multiple-part combined decryption and verification operation, processing another data part. Returns a recovered data in string, if successful.

derive-keycfunction
src/key.c at line 140, column 1
(derive-key session-obj mechanism base-key-handle template)

Derives a key from a base key, creating a new key object. Returns a `key-handle`, if successful.

destroy-objectcfunction
src/object.c at line 52, column 1
(destory-object session-obj obj-handle)

Destroys an object.

digestcfunction
src/digest.c at line 30, column 1
(digest session-obj data)

Digests data in a single part. Returns an message digest in string, if successful.

digest-encrypt-updatecfunction
src/dual.c at line 11, column 1
(digest-encrypt-update session-obj data)

Continues multiple-part digest and encryption operations, processing another data part. Returns an encrypted data in string, if successful.

digest-finalcfunction
src/digest.c at line 92, column 1
(digest-final session-obj)

Finishes a multiple-part message-digesting operation. Return the message digest in string, if successful.

digest-initcfunction
src/digest.c at line 11, column 1
(digest-init session-obj mechanism)

Initializes a message-digesting operation. Returns a `session-obj`, if successful.

digest-keycfunction
src/digest.c at line 75, column 1
(digest-key session-obj key-handle)

Continues a multiple-part message-digesting operation by digesting the value of a secret key. Returns a `session-obj`, if successful.

digest-updatecfunction
src/digest.c at line 57, column 1
(digest-update session-obj data)

Continues a multiple-part message-digesting operation, processing another `data` part. Returns a `session-obj`, if successful.

encryptcfunction
src/encrypt.c at line 31, column 1
(encrypt session-obj data)

Encrypts single-part data. Returns an encrypted data in string, if successful.

encrypt-finalcfunction
src/encrypt.c at line 87, column 1
(encrypt-final session-obj)

Finishes a multiple-part encryption operation. Return the last encrypted data part in string, if successful.

encrypt-initcfunction
src/encrypt.c at line 11, column 1
(encrypt-init session-obj mechanism key-handle)

Initializes an encryption operation. Returns a `session-obj`, if successful.

encrypt-updatecfunction
src/encrypt.c at line 59, column 1
(encrypt-update session-obj data)

Continues a multiple-part encryption operation, processing another `data` part. Return the encrypted data part in string, if successful.

find-objectscfunction
src/object.c at line 162, column 1
(find-objects session-obj max-obj-count)

Continues a search for token and session objects that match a `template`. Returns a list of `obj-handle`, if successful.

find-objects-finalcfunction
src/object.c at line 188, column 1
(find-objects-final session-obj)

Terminates a search for token and session objects. Returns a `session-obj`, if successful.

find-objects-initcfunction
src/object.c at line 135, column 1
(find-objects-init session-obj &opt template)

Initializes a search for token and session objects that match a `template`. Find all objects if `template` is not provided. Returns a `session-obj`, if successful.

generate-keycfunction
src/key.c at line 12, column 1
(generate-key session-obj mechanism &opt template)

Generates a secret key or set of domain parameters, creating a new key object. Returns a `key-handle`, if successful.

generate-key-paircfunction
src/key.c at line 41, column 1
(generate-key-pair session-obj mechanism pubkey-template privkey-template)

Generates a public/private key pair, creating new key objects. Returns a list of [pubkey-handle privkey-handle], if successful.

generate-randomcfunction
src/random.c at line 27, column 1
(generate-random session-obj length)

Generates random or pseudo-random data. Returns the `length` bytes of random data in string format, if successful.

get-attribute-valuecfunction
src/object.c at line 85, column 1
(get-attribute-value session-obj obj-handle attr-list)

Obtains the value of one or more attributes of an object. Returns a template struct, if successful.

get-infocfunction
src/main.c at line 111, column 1
(get-info p11-obj)

Returns general information about Cryptoki.

get-mechanism-infocfunction
src/slot_and_token.c at line 240, column 1
(get-mechanism-info p11-obj slot-id &opt mechanism-list)

Returns a list of mechanisms information of `mechanism-list` list.`slot-id` is the ID of the token’s slot. If `mechanism-list` is not provided, return list of all avaiable mechanism information.

get-mechanism-listcfunction
src/slot_and_token.c at line 209, column 1
(get-mechanism-list p11-obj slot-id)

Returns a list of mechanisms supported by a token.`slot-id` is the ID of the token’s slot.

get-object-sizecfunction
src/object.c at line 68, column 1
(get-object-size session-obj obj-handle)

Returns the size of an object in bytes

get-operation-statecfunction
src/session.c at line 200, column 1
(get-operation-state session-obj)

Returns the cryptographic operations state of a session in string.

get-session-infocfunction
src/session.c at line 178, column 1
(get-session-info session-obj)

Returns an information about a session.

get-slot-infocfunction
src/slot_and_token.c at line 63, column 1
(get-slot-info p11-obj &opt slot-id)

Returns information about a particular slot in the system. If `slot-id` is not provided, information about all slots is returned as a list. If there is no slot corresponding to `slot-id` or no slot exists in system, `nil` is returned.

get-slot-listcfunction
src/slot_and_token.c at line 32, column 1
(get-slot-list p11-obj)

Returns a list of slots in the system

get-token-infocfunction
src/slot_and_token.c at line 129, column 1
(get-token-info p11-obj slot-id)

Returns information about a particular token in the system. `slot-id` is the ID of the token’s slot.

hex-decodecfunction
src/utils.c at line 87, column 1
(hex-decode str)

Performs hex decoding of string data in `str`. Returns the string.

hex-encodecfunction
src/utils.c at line 67, column 1
(hex-encode bin)

Performs hex encoding of binary data in `bin`. Returns the string.

init-pincfunction
src/slot_and_token.c at line 318, column 1
(init-pin session-obj pin)

Initializes the normal user’s PIN. Returns `session-obj`, if successful.

init-tokencfunction
src/slot_and_token.c at line 292, column 1
(init-token p11-obj slot-id so-pin label)

Initializes a token. Return `p11-obj`, if successful.

logincfunction
src/session.c at line 220, column 1
(login session-obj user-type pin)

Logs a user into a token. `user-type` must be one of the following: :so, :user, or :context-specific. Returns `session-obj`, if successful.

logoutcfunction
src/session.c at line 250, column 1
(logout session-obj)

Logs a user out from a token. Returns `session-obj`, if successful.

newcfunction
src/main.c at line 77, column 1
(new lib-path)

Get the `p11-obj`(an instance holding a handle to the opened PKCS#11 library).

open-sessioncfunction
src/session.c at line 119, column 1
(open-session p11-obj slot-id &opt :read-only)

Opens a session between an application and a token in a particular slot. Opens R/W session unless `:read-only` is passed. Returns `session-obj`, if successful.

seed-randomcfunction
src/random.c at line 10, column 1
(seed-random session-obj seed)

Mixes additional seed material into the token’s random number generator.Returns a `session-obj`, if successful.

set-attribute-valuecfunction
src/object.c at line 114, column 1
(set-attribute-value session-obj obj-handle template)

Modifies the value of one or more attributes of an object. Returns a `session-obj`, if successful.

set-pincfunction
src/slot_and_token.c at line 335, column 1
(set-pin session-obj old-pin new-pin)

Modifies the PIN of the user that is currently logged in, or the normal user's' PIN if the session is not logged in. Returns `session-obj`, if successful.

signcfunction
src/sign.c at line 31, column 1
(sign session-obj data)

Signs data in a single part. Returns a signature of the data in string, if successful.

sign-encrypt-updatecfunction
src/dual.c at line 68, column 1
(sign-encrypt-update session-obj data)

Continues multiple-part combined signature and encryption operations, processing another data part. Returns an encrypted data in string, if successful.

sign-finalcfunction
src/sign.c at line 77, column 1
(sign-final session-obj)

Finishes a multiple-part signature operation. Return a signature of the data in string, if successful.

sign-initcfunction
src/sign.c at line 11, column 1
(sign-init session-obj mechanism key-handle)

Initializes a signature operation. Returns a `session-obj`, if successful.

sign-recovercfunction
src/sign.c at line 120, column 1
(sign-recover session-obj data)

Signs data in a single operation, where the data can be recovered from the signature. Returns a signature of the data in string, if successful.

sign-recover-initcfunction
src/sign.c at line 100, column 1
(sign-recover-init session-obj mechanism key-handle)

Initializes a signature operation, where the data can be recovered from the signature. Returns a `session-obj`, if successful.

sign-updatecfunction
src/sign.c at line 59, column 1
(sign-update session-obj data)

Continues a multiple-part signature operation, processing another `data` part. Returns a `session-obj`, if successful.

unwrap-keycfunction
src/key.c at line 110, column 1
(unwrap-key session-obj mechanism unwrapping-key-handle wrapped-key template)

Unwraps (i.e. decrypts) a wrapped key, creating a new private key or secret key object. Returns a `key-handle`, if successful.

verifycfunction
src/verify.c at line 31, column 1
(verify session-obj data signature)

Verifies a signature in a single-part operation. Returns a boolean, if successful.

verify-finalcfunction
src/verify.c at line 76, column 1
(verify-final session-obj signature)

Finishes a multiple-part verification operation, checking the signature. Returns a boolean, if successful.

verify-initcfunction
src/verify.c at line 11, column 1
(verify-init session-obj mechanism key-handle)

Initializes a verification operation. Returns a `session-obj`, if successful.

verify-recovercfunction
src/verify.c at line 121, column 1
(verify-recover session-obj signature)

Verifies a signature in a single-part operation, where the data is recovered from the signature. If successful, resturns tuple of [boolean string], where string is a recovered data.

verify-recover-initcfunction
src/verify.c at line 101, column 1
(verify-recover-init session-obj mechanism key-handle)

Initializes a signature verification operation, where the data is recovered from the signature. Returns a `session-obj`, if successful.

verify-updatecfunction
src/verify.c at line 58, column 1
(verify-update session-obj data)

Continues a multiple-part verification operation, processing another `data` part. Returns a `session-obj`, if successful.

wait-for-slot-eventcfunction
src/slot_and_token.c at line 174, column 1
(wait-for-slot-event p11-obj)

Returns a list of slot-id of slots where events occurred. Returns `nil` if there are no event in any slots.

wrap-keycfunction
src/key.c at line 78, column 1
(wrap-key session-obj mechanism wrapping-key-handle key-handle)

Wraps (i.e., encrypts) a private or secret key.Returns a wrapped key in string, if successful.