انتقل إلى المحتوى الرئيسي

Interface: Pkcs11Library

Defined in: packages/key-custodian/src/pkcs11/library.ts:86

The calls the adapter makes. pkcs11js's PKCS11 satisfies it, which the loader below proves at compile time. A fake for tests implements these methods and nothing else.

Methods​

C_CloseSession()​

C_CloseSession(session): void

Defined in: packages/key-custodian/src/pkcs11/library.ts:102

Closes one session.

Parameters​

session​

Pkcs11Handle

Returns​

void


C_DecryptAsync()​

C_DecryptAsync(session, inData, outData): Promise<Buffer<ArrayBufferLike>>

Defined in: packages/key-custodian/src/pkcs11/library.ts:151

Decrypts in one part, off the event loop. As Pkcs11Library.C_EncryptAsync.

Parameters​

session​

Pkcs11Handle

inData​

Buffer

outData​

Buffer

Returns​

Promise<Buffer<ArrayBufferLike>>


C_DecryptInit()​

C_DecryptInit(session, mechanism, key): void

Defined in: packages/key-custodian/src/pkcs11/library.ts:145

Starts a decryption.

Parameters​

session​

Pkcs11Handle

mechanism​

Pkcs11Mechanism

key​

Pkcs11Handle

Returns​

void


C_DestroyObject()​

C_DestroyObject(session, object): void

Defined in: packages/key-custodian/src/pkcs11/library.ts:118

Destroys an object.

Parameters​

session​

Pkcs11Handle

object​

Pkcs11Handle

Returns​

void


C_EncryptAsync()​

C_EncryptAsync(session, inData, outData): Promise<Buffer<ArrayBufferLike>>

Defined in: packages/key-custodian/src/pkcs11/library.ts:143

Encrypts in one part, off the event loop. Returns outData sliced to the output's length. An outData too small leaves the operation active on the session (CKR_BUFFER_TOO_SMALL), so callers size it for the whole output.

Parameters​

session​

Pkcs11Handle

inData​

Buffer

outData​

Buffer

Returns​

Promise<Buffer<ArrayBufferLike>>


C_EncryptInit()​

C_EncryptInit(session, mechanism, key): void

Defined in: packages/key-custodian/src/pkcs11/library.ts:133

Starts an encryption.

Parameters​

session​

Pkcs11Handle

mechanism​

Pkcs11Mechanism

key​

Pkcs11Handle

Returns​

void


C_Finalize()​

C_Finalize(): void

Defined in: packages/key-custodian/src/pkcs11/library.ts:92

Releases the module.

Returns​

void


C_FindObjects()​

C_FindObjects(session, maxObjectCount): Pkcs11Handle[]

Defined in: packages/key-custodian/src/pkcs11/library.ts:108

Continues a search, returning at most maxObjectCount handles.

Parameters​

session​

Pkcs11Handle

maxObjectCount​

number

Returns​

Pkcs11Handle[]


C_FindObjectsFinal()​

C_FindObjectsFinal(session): void

Defined in: packages/key-custodian/src/pkcs11/library.ts:110

Ends a search.

Parameters​

session​

Pkcs11Handle

Returns​

void


C_FindObjectsInit()​

C_FindObjectsInit(session, template): void

Defined in: packages/key-custodian/src/pkcs11/library.ts:106

Starts a search.

Parameters​

session​

Pkcs11Handle

template​

Pkcs11Attribute[]

Returns​

void


C_GenerateKeyAsync()​

C_GenerateKeyAsync(session, mechanism, template): Promise<Pkcs11Handle>

Defined in: packages/key-custodian/src/pkcs11/library.ts:127

Generates a secret key, off the event loop.

Parameters​

session​

Pkcs11Handle

mechanism​

Pkcs11Mechanism

template​

Pkcs11Attribute[]

Returns​

Promise<Pkcs11Handle>


C_GenerateKeyPairAsync()​

C_GenerateKeyPairAsync(session, mechanism, publicTemplate, privateTemplate): Promise<{ privateKey: Pkcs11Handle; publicKey: Pkcs11Handle; }>

Defined in: packages/key-custodian/src/pkcs11/library.ts:120

Generates a key pair, off the event loop.

Parameters​

session​

Pkcs11Handle

mechanism​

Pkcs11Mechanism

publicTemplate​

Pkcs11Attribute[]

privateTemplate​

Pkcs11Attribute[]

Returns​

Promise<{ privateKey: Pkcs11Handle; publicKey: Pkcs11Handle; }>


C_GetAttributeValue()​

C_GetAttributeValue(session, object, template): Pkcs11AttributeValue[]

Defined in: packages/key-custodian/src/pkcs11/library.ts:112

Reads attributes.

Parameters​

session​

Pkcs11Handle

object​

Pkcs11Handle

template​

Pkcs11Attribute[]

Returns​

Pkcs11AttributeValue[]


C_GetMechanismList()​

C_GetMechanismList(slot): number[]

Defined in: packages/key-custodian/src/pkcs11/library.ts:98

The mechanisms a slot's token supports.

Parameters​

slot​

Pkcs11Handle

Returns​

number[]


C_GetSlotList()​

C_GetSlotList(tokenPresent?): Pkcs11Handle[]

Defined in: packages/key-custodian/src/pkcs11/library.ts:94

Slots, with or without a token present.

Parameters​

tokenPresent?​

boolean

Returns​

Pkcs11Handle[]


C_GetTokenInfo()​

C_GetTokenInfo(slot): Pkcs11TokenInfo

Defined in: packages/key-custodian/src/pkcs11/library.ts:96

The token in a slot.

Parameters​

slot​

Pkcs11Handle

Returns​

Pkcs11TokenInfo


C_Initialize()​

C_Initialize(options?): void

Defined in: packages/key-custodian/src/pkcs11/library.ts:90

Initialises the module. Throws CKR_CRYPTOKI_ALREADY_INITIALIZED if it already is.

Parameters​

options?​
flags?​

number

Returns​

void


C_Login()​

C_Login(session, userType, pin?): void

Defined in: packages/key-custodian/src/pkcs11/library.ts:104

Logs the application in to the token. Login state is shared by every session.

Parameters​

session​

Pkcs11Handle

userType​

number

pin?​

string

Returns​

void


C_OpenSession()​

C_OpenSession(slot, flags): Pkcs11Handle

Defined in: packages/key-custodian/src/pkcs11/library.ts:100

Opens a session on a slot.

Parameters​

slot​

Pkcs11Handle

flags​

number

Returns​

Pkcs11Handle


C_SignAsync()​

C_SignAsync(session, inData, outData): Promise<Buffer<ArrayBufferLike>>

Defined in: packages/key-custodian/src/pkcs11/library.ts:155

Signs, off the event loop. Returns outData sliced to the signature's length.

Parameters​

session​

Pkcs11Handle

inData​

Buffer

outData​

Buffer

Returns​

Promise<Buffer<ArrayBufferLike>>


C_SignInit()​

C_SignInit(session, mechanism, key): void

Defined in: packages/key-custodian/src/pkcs11/library.ts:153

Starts a signature.

Parameters​

session​

Pkcs11Handle

mechanism​

Pkcs11Mechanism

key​

Pkcs11Handle

Returns​

void


load()​

load(path): void

Defined in: packages/key-custodian/src/pkcs11/library.ts:88

Loads the module at path (dlopen).

Parameters​

path​

string

Returns​

void