Forum >
NCryptoki Forum
> session.Objects.find always returns null
session.Objects.find always returns null
session.Objects.find always returns null
I´d like to collect the certificates on out corporate <span data-scayt_word="smartcard" data-scaytid="23">smartcard in order to create a digital signature on <span data-scayt_word="PDFs" data-scaytid="43">PDFs using the <span data-scayt_word="iTextSharp" data-scaytid="35">iTextSharp library (as of the example by Bruno <span data-scayt_word="Lowagie" data-scaytid="75">Lowagie).
But whatever I do, 'find' returns null.
<span data-scayt_word="CryptokiCollection" data-scaytid="11">CryptokiCollection template = new <span data-scayt_word="CryptokiCollection" data-scaytid="2">CryptokiCollection();
template.Add(new <span data-scayt_word="ObjectAttribute" data-scaytid="3">ObjectAttribute(ObjectAttribute.CKA_CLASS, CryptokiObject.CKO_CERTIFICATE));
template.Add(new <span data-scayt_word="ObjectAttribute" data-scaytid="7">ObjectAttribute(ObjectAttribute.CKA_CERTIFICATE_TYPE, Certificate.CKC_X_509));
template.Add(new <span data-scayt_word="ObjectAttribute" data-scaytid="8">ObjectAttribute(ObjectAttribute.CKA_LABEL, alias));
Cryptware.NCryptoki.X509Certificate <span data-scayt_word="nCert" data-scaytid="10">nCert = (Cryptware.NCryptoki.X509Certificate)session.Objects.Find(template);
alias = "Signature" or "Authentication"
Does anybody know a possible reason?
Card is inside of slot and can be read (as session.token.info can be accessed and s<span data-scayt_word="whows" data-scaytid="63">hows data of its owner).
Thanks in advance
Guido
|
Re: session.Objects.find always returns null
I can add some information now.
Before I´ve added any <span data-scayt_word="ObjectAttribute" data-scaytid="1">ObjectAttribute, session.Objects.Find(template) returns one single certificate with the certificate_type_name "X_509".
The first two <span data-scayt_word="ObjectAttributes" data-scaytid="33">ObjectAttributes are not changing the return of the 'find' method. But the addition of alias (here "Signature") does not allow any return of certificate objects.
So, what does the <span data-scayt_word="CKA_LABEL" data-scaytid="69">CKA_LABEL property refer to?
And how can it be, that there´s only one single certificate (<span data-scayt_word="X509" data-scaytid="53">X509) on the <span data-scayt_word="smartcard" data-scaytid="79">smartcard?
I will also need a private key, but that cannot be found on the card. Is it maybe, that it´s not extractable?
Thanks,
Guido
|