|
我有一个dll的函数,定义:
ULONG SKF_RSAExportSessionKey (HCONTAINER hContainer, ULONG ulAlgId, RSAPUBLICKEYBLOB *pPubKey, BYTE *pbData, ULONG *pulDataLen, HANDLE *phSessionKey);
在python里该如何调用,我试着以下方式,一直不行,有人有这方面的代码吗?或者帮我看看,主要是c++里的指针之类在python里该如何处理
def hzfcca_RSAExportSessionKey(self, pPubKey):
class RSAPUBLICKEYBLOB(Structure):
_fields_ = [("AlgID", c_ulong),
("BitLen", c_ulong),
("Modulus", c_byte * 256),
("PublicExponent", c_byte * 4)]
RSAExportSessionKey= self.dll.SKF_RSAExportSessionKey
RSAExportSessionKey.argtypes = [c_long, c_ulong, POINTER(RSAPUBLICKEYBLOB), POINTER(c_byte), POINTER(c_ulong), POINTER(c_long)]
RSAExportSessionKey.restype = c_ulong
ulAlgId = c_ulong(0x00000101)
pbData = c_byte()
pbDataLen = c_ulong()
phSessionKey = c_long(0)
res = RSAExportSessionKey(c_long(self.hcon), ulAlgId, byref(pPubKey), pbData, pbDataLen, phSessionKey)
print(pbDataLen)
print(res)
if res == 0:
return True
else:
return False
|
|