Package PyKCS11 :: Class PyKCS11Lib
[hide private]
[frames] | no frames]

Class PyKCS11Lib

source code

object --+
         |
        PyKCS11Lib

high level PKCS#11 binding

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__del__(self) source code
 
load(self, pkcs11dll_filename=None, *init_string)
load a PKCS#11 library
source code
 
initToken(self, slot, pin, label)
C_InitToken
source code
 
getInfo(self)
C_GetInfo
source code
list
getSlotList(self, tokenPresent=False)
C_GetSlotList
source code
 
getSlotInfo(self, slot)
C_GetSlotInfo
source code
 
getTokenInfo(self, slot)
C_GetTokenInfo
source code
 
openSession(self, slot, flags=0)
C_OpenSession
source code
 
closeAllSessions(self, slot)
C_CloseAllSessions
source code
list
getMechanismList(self, slot)
C_GetMechanismList
source code
a CK_MECHANISM_INFO object
getMechanismInfo(self, slot, type)
C_GetMechanismInfo
source code
integer
waitForSlotEvent(self, flags=0)
C_WaitForSlotEvent
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

load(self, pkcs11dll_filename=None, *init_string)

source code 

load a PKCS#11 library

Parameters:
  • pkcs11dll_filename (string) - the library name. If this parameter is not set the environment variable PYKCS11LIB is used instead
Returns:
a PyKCS11Lib object
Raises:

initToken(self, slot, pin, label)

source code 

C_InitToken

Parameters:
  • slot (integer) - slot number returned by getSlotList
  • pin - SO's initial PIN
  • label - new label of the token

getInfo(self)

source code 

C_GetInfo

Returns:
a CK_INFO object

getSlotList(self, tokenPresent=False)

source code 

C_GetSlotList

Parameters:
  • tokenPresent (bool) - False (default) to list all slots, True to list only slots with present tokens
Returns: list
a list of available slots

getSlotInfo(self, slot)

source code 

C_GetSlotInfo

Parameters:
Returns:
a CK_SLOT_INFO object

getTokenInfo(self, slot)

source code 

C_GetTokenInfo

Parameters:
Returns:
a CK_TOKEN_INFO object

openSession(self, slot, flags=0)

source code 

C_OpenSession

Parameters:
  • slot (integer) - slot number returned by getSlotList
  • flags (integer) - 0 (default), CKF_RW_SESSION for RW session
Returns:
a Session object

closeAllSessions(self, slot)

source code 

C_CloseAllSessions

Parameters:
  • slot (integer) - slot number

getMechanismList(self, slot)

source code 

C_GetMechanismList

Parameters:
Returns: list
the list of available mechanisms for a slot

getMechanismInfo(self, slot, type)

source code 

C_GetMechanismInfo

Parameters:
  • slot (integer) - slot number returned by getSlotList
  • type (integer) - a CKM_* type
Returns: a CK_MECHANISM_INFO object
information about a mechanism

waitForSlotEvent(self, flags=0)

source code 

C_WaitForSlotEvent

Parameters:
  • flags (integer) - 0 (default) or CKF_DONT_BLOCK
Returns: integer
slot