|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
Hi,
Can you tell me how can i access the certificates from an eToken by Alladin? I tryed using Capicom, but i got the error: "Keyset does not exist". Probabilly because I do not provide the pin of the eToken. Here is the code trying to access the certificates: Store store = new StoreClass(); try { oStore.Open (CAPICOM_STORE_LOCATION.CAPICOM_SMART_CARD_USER_STORE, storeName, CAPICOM_STORE_OPEN_MODE.CAPICOM_STORE_OPEN_EXISTING_ONLY | CAPICOM_STORE_OPEN_MODE.CAPICOM_STORE_OPEN_READ_ONLY); oCerts = (Certificates)oStore.Certificates; } catch (Exception ex) { d.debug(ex.ToString()); // d.debug() – is a method that open a messege box: Message.Show(…) //here I get the error I will specify at the end of this code. } oCerts = (Certificates)oCerts.Find(CAPICOM_CERTIFICATE_FIND_TYPE.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME, "razvan", true); foreach (Certificate cert in oCerts) cert.Display(); IEnumerator certnum = oCerts.GetEnumerator(); while (certnum.MoveNext()) { Certificate ocert = (Certificate)certnum.Current; ocert.Display(); } if (oCerts.Count > 0) { Certificate firstcert = (Certificate)oCerts[1]; firstcert.Display(); ICertContext iCertCntxt = (ICertContext)firstcert; int certcntxt = iCertCntxt.CertContext; IntPtr hCertCntxt = new IntPtr(certcntxt); if (hCertCntxt != IntPtr.Zero) { Console.WriteLine("CertContext:\t0x{0:X}", hCertCntxt.ToInt32()); X509Certificate foundcert = new X509Certificate(hCertCntxt); d.debug("SubjectName:\t{0}", foundcert.GetName().ToString()); d.debug ("Serial No:\t{0}", foundcert.GetSerialNumberString().ToString()); d.debug ("HashString:\t{0}", foundcert.GetCertHashString().ToString()); } } |
|||
|
Please refer to the Developers Guide, page 118 where you can find some samples at .NET + documentation which can assist you.
This developer guide can be located in the following path once you install etoken sdk 3.60: C:\Program Files\Aladdin\eToken\SDK\Documents\ For any further assistance, feel free to write here |
||||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

