Hi <span data-scayt_word="Ugo" data-scaytid="18">Ugo,
I'm trying to get the certificate from a CNS card using a <span data-scayt_word="Powerbuider" data-scaytid="19">Powerbuider application.
I use as <span data-scayt_word="PKCS" data-scaytid="20">PKCS#11 <span data-scayt_word="dll" data-scaytid="21">dll module BIT4IPKI.DLL.
Here is the code I use to get the certificate on the CNS:
<span data-scayt_word="oleobject" data-scaytid="22">oleobject template, <span data-scayt_word="objectAttribute" data-scaytid="23">objectAttribute, objects,<span data-scayt_word="CryptokiObject" data-scaytid="24">CryptokiObject
<span data-scayt_word="int" data-scaytid="25">int ret,count
constant <span data-scayt_word="ulong" data-scaytid="26">ulong <span data-scayt_word="CKA_CLASS" data-scaytid="29">CKA_CLASS = 0 // #define <span data-scayt_word="CKA_CLASS" data-scaytid="30">CKA_CLASS <span data-scayt_word="0x00000000UL" data-scaytid="31">0x00000000UL
constant <span data-scayt_word="ulong" data-scaytid="27">ulong <span data-scayt_word="CKO_CERTIFICATE" data-scaytid="33">CKO_CERTIFICATE = 1 //#define <span data-scayt_word="CKO_CERTIFICATE" data-scaytid="34">CKO_CERTIFICATE <span data-scayt_word="0x00000001UL" data-scaytid="35">0x00000001UL
constant <span data-scayt_word="ulong" data-scaytid="28">ulong <span data-scayt_word="CKC_X_509" data-scaytid="36">CKC_X_509 = 0 // #define <span data-scayt_word="CKC_X_509" data-scaytid="37">CKC_X_509 <span data-scayt_word="0x00000000UL" data-scaytid="32">0x00000000UL
constant <span data-scayt_word="ulong" data-scaytid="38">ulong <span data-scayt_word="CKA_CERTIFICATE_TYPE" data-scaytid="39">CKA_CERTIFICATE_TYPE = 128 //#define <span data-scayt_word="CKA_CERTIFICATE_TYPE" data-scaytid="40">CKA_CERTIFICATE_TYPE <span data-scayt_word="0x00000080UL" data-scaytid="41">0x00000080UL
template = CREATE <span data-scayt_word="OLEObject" data-scaytid="46">OLEObject
ret = template.ConnectToNewObject ( "Cryptware.Ncryptoki.CryptokiCollection" )
if ret < 0 then
return ret
end if
<span data-scayt_word="objectAttribute" data-scaytid="47">objectAttribute = CREATE <span data-scayt_word="OLEObject" data-scaytid="48">OLEObject
ret = objectAttribute.ConnectToNewObject ( "Cryptware.Ncryptoki.ObjectAttribute")
if ret < 0 then
return ret
end if
objectAttribute.Set(<span data-scayt_word="CKA_CLASS" data-scaytid="49">CKA_CLASS, <span data-scayt_word="CKO_CERTIFICATE" data-scaytid="50">CKO_CERTIFICATE)
template.add(<span data-scayt_word="objectattribute" data-scaytid="53">objectattribute)
//objectAttribute.Set(<span data-scayt_word="CKA_CERTIFICATE_TYPE" data-scaytid="54">CKA_CERTIFICATE_TYPE, <span data-scayt_word="CKC_X_509" data-scaytid="55">CKC_X_509)
//template.add(<span data-scayt_word="objectattribute" data-scaytid="56">objectattribute)
objects = CREATE <span data-scayt_word="OLEObject" data-scaytid="57">OLEObject
ret = objects.ConnectToNewObject ( "Cryptware.Ncryptoki.CryptokiCollection" )
if ret < 0 then
return ret
end if
objects = i_session.Objects.Find(template, 2)
count = objects.count
....
I don't get any object in fact the value of the variable count is always 0.
Could you help me to <span data-scayt_word="understrnd" data-scaytid="63">understrnd where I am wrong?