@@ -225,7 +225,7 @@ class Slot(types.Slot):
225225class Token (types .Token ):
226226 """Extend Token with implementation."""
227227
228- def open (self , rw = False , user_pin = None , so_pin = None , p_auth = False ):
228+ def open (self , rw = False , user_pin = None , so_pin = None , use_protected_auth = False ):
229229 cdef CK_SESSION_HANDLE handle
230230 cdef CK_FLAGS flags = CKF_SERIAL_SESSION
231231 cdef CK_USER_TYPE user_type
@@ -235,11 +235,11 @@ class Token(types.Token):
235235
236236 if user_pin is not None and so_pin is not None :
237237 raise ArgumentsBad ("Set either `user_pin` or `so_pin`" )
238- elif user_pin is not None and use_pap :
239- raise ArgumentsBad ("Set either `user_pin` or `p_auth `" )
240- elif so_pin is not None and use_pap :
241- raise ArgumentsBad ("Set either `so_pin` or `p_auth `" )
242- elif p_auth :
238+ elif user_pin is not None and use_protected_auth :
239+ raise ArgumentsBad ("Set either `user_pin` or `use_protected_auth `" )
240+ elif so_pin is not None and use_protected_auth :
241+ raise ArgumentsBad ("Set either `so_pin` or `use_protected_auth `" )
242+ elif use_protected_auth :
243243 pin = None
244244 user_type = CKU_USER
245245 elif user_pin is not None :
@@ -254,11 +254,11 @@ class Token(types.Token):
254254
255255 assertRV (_funclist .C_OpenSession (self .slot .slot_id , flags , NULL , NULL , & handle ))
256256
257- if p_auth :
257+ if use_protected_auth :
258258 if self .flags & TokenFlag .PROTECTED_AUTHENTICATION_PATH :
259- assertRV (_funclist .C_Login (handle , user_type , NULL , < CK_ULONG > 0 ))
259+ assertRV (_funclist .C_Login (handle , user_type , NULL , < CK_ULONG > 0 ))
260260 else :
261- raise ArgumentsBad (' Protected authentication is not supported by loaded module' )
261+ raise ArgumentsBad (" Protected authentication is not supported by loaded module" )
262262 elif pin is not None :
263263 assertRV (_funclist .C_Login (handle , user_type , pin , < CK_ULONG > len (pin )))
264264
0 commit comments