<link>http://www.ncryptoki.com/forum.aspx</link> <description /> <docs>http://www.rssboard.org/rss-specification</docs> <generator>mojoPortal Forum module</generator> <item> <title>Get CNS certificate with NCRYPTOKI Hi Ugo,

I'm trying to get the certificate from a CNS card using a Powerbuider application.

I use as PKCS#11 dll module BIT4IPKI.DLL.
Here is the code I use to get the certificate on the CNS:

oleobject template, objectAttribute, objects,CryptokiObject
int ret,count

constant ulong CKA_CLASS = 0 // #define CKA_CLASS 0x00000000UL
constant ulong CKO_CERTIFICATE = 1 //#define CKO_CERTIFICATE 0x00000001UL
constant ulong CKC_X_509 = 0 // #define CKC_X_509 0x00000000UL
constant ulong CKA_CERTIFICATE_TYPE = 128 //#define CKA_CERTIFICATE_TYPE 0x00000080UL


template = CREATE OLEObject
ret = template.ConnectToNewObject ( "Cryptware.Ncryptoki.CryptokiCollection" )
if ret < 0 then
return ret
end if

objectAttribute = CREATE OLEObject
ret = objectAttribute.ConnectToNewObject ( "Cryptware.Ncryptoki.ObjectAttribute")
if ret < 0 then
return ret
end if


objectAttribute.Set(CKA_CLASS, CKO_CERTIFICATE)
template.add(objectattribute)


//objectAttribute.Set(CKA_CERTIFICATE_TYPE, CKC_X_509)
//template.add(objectattribute)

objects = CREATE 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 understrnd where I am wrong?
 

]]>
http://www.ncryptoki.com/Forums/Thread.aspx?pageid=9&t=196~-1#post804 guido.privitera http://www.ncryptoki.com/Forums/Thread.aspx?pageid= Tue, 09 Jun 2015 10:44:27 GMT