Changeset 115
- Timestamp:
- 02/11/08 09:09:17 (2 years ago)
- Files:
-
- pykcs11/trunk/PyKCS11/__init__.py (modified) (1 diff)
- pykcs11/trunk/samples/getinfo.py (modified) (1 diff)
- pykcs11/trunk/src/pkcs11lib.cpp (modified) (1 diff)
- pykcs11/trunk/src/pkcs11lib.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
pykcs11/trunk/PyKCS11/__init__.py
r101 r115 445 445 return s 446 446 447 def getMechanismList(self, slot): 448 """ 449 C_GetMechanismList 450 451 @return: the list of available mechanisms for a slot 452 @rtype: list 453 """ 454 mechanismList = PyKCS11.LowLevel.ckintlist() 455 rv = self.lib.C_GetMechanismList(slot, mechanismList) 456 if rv != CKR_OK: 457 raise PyKCS11Error(rv) 458 459 m = [] 460 for x in xrange(len(mechanismList)): 461 m.append(CKM[mechanismList[x]]) 462 return m 463 447 464 class Mechanism: 448 465 """Wraps CK_MECHANISM""" pykcs11/trunk/samples/getinfo.py
r99 r115 116 116 colorize(" utcTime:", t.utcTime) 117 117 118 m = pkcs11.getMechanismList(slots[slot]) 119 print " Mechanism list: " 120 for x in m: 121 print " " + blue + x + normal 122 118 123 if pin_available: 119 124 session.logout() pykcs11/trunk/src/pkcs11lib.cpp
r111 r115 952 952 } 953 953 954 CK_RV CPKCS11Lib::C_GetMechanismList( 955 unsigned long slotID, 956 vector<long> &mechanismList) 957 { 958 CPKCS11LIB_PROLOGUE(C_GetMechanismList); 959 960 CK_ULONG i; 961 mechanismList.clear(); 962 CK_MECHANISM_TYPE ck_mechanismList[1024]; 963 CK_ULONG ulCount = sizeof(ck_mechanismList)/sizeof(ck_mechanismList[0]); 964 rv = m_pFunc->C_GetMechanismList(slotID, ck_mechanismList, &ulCount); 965 if (CKR_OK == rv) 966 for(i=0; i<ulCount; i++) 967 mechanismList.push_back(ck_mechanismList[i]); 968 969 CPKCS11LIB_EPILOGUE; 970 return rv; 971 } 972 954 973 /////////////////////////////////////////////////////////////////////////////// 955 974 pykcs11/trunk/src/pkcs11lib.h
r112 r115 283 283 unsigned long* pSlot); 284 284 285 CK_RV C_GetMechanismList( 286 unsigned long slotID, 287 vector<long> &mechanismList); 288 285 289 }; 286 290
