Domanda

I have this code:

import comtypes
from comtypes.client import CreateObject
certadmin = CreateObject("CertificateAuthority.Admin")
certadmin._ICertAdmin2__com_GetArchivedKey('hostname\\simpleca', 35, 'CR_OUT_BASE64', comtypes.BSTR(' '))

However, I'm problems with a data type, e.g.

Traceback (most recent call last):
File "<input>", line 1, in <module>
ArgumentError: argument 3: <type 'exceptions.TypeError'>: wrong type

Any suggestions would be really appreciated.

È stato utile?

Soluzione

A wild guess. The third argument of the GetArchivedKey method should be a number. You're passing the string CR_OUT_BASE64. Probably this should work:

certadmin._ICertAdmin2__com_GetArchivedKey('hostname\\simpleca', 35, 1, comtypes.BSTR(' '))

CR_OUT_BASE64 constant is equal to 1.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top