我有这段代码:
import comtypes
from comtypes.client import CreateObject
certadmin = CreateObject("CertificateAuthority.Admin")
certadmin._ICertAdmin2__com_GetArchivedKey('hostname\\simpleca', 35, 'CR_OUT_BASE64', comtypes.BSTR(' '))
但是,我遇到数据类型的问题,例如
Traceback (most recent call last):
File "<input>", line 1, in <module>
ArgumentError: argument 3: <type 'exceptions.TypeError'>: wrong type
任何建议都会非常感激。
答案 0 :(得分:0)
疯狂猜测。 GetArchivedKey
方法的第三个参数应该是一个数字。您正在传递字符串CR_OUT_BASE64
。可能这应该有效:
certadmin._ICertAdmin2__com_GetArchivedKey('hostname\\simpleca', 35, 1, comtypes.BSTR(' '))
CR_OUT_BASE64
常数等于1.