Certificate Management

The advantage of the Aloaha CSP APIs is that the user does not need to know in which connected card reader the card is located. Aloaha uses several algorythm to find the right reader.


Functions

The function get_certificate_by_reader returns the certificate of a card inserted in a known card reader.

function get_certificate_by_reader(ByVal LngReader As Long, ByRef CertificateBA As Variant, ByRef CA_BA As Variant, ByVal ctype As CertificateType) as boolean

For example

Dim LngReader as long
Dim CertificateBA() as byte
Dim CA_BA() as byte
Dim ctype as long
Dim CertificateString as String

ctype = 0           ' read non repudiation certificate
LngReader = 0 ' use first connected card reader

if ACSP.get_certificate_by_reader(LngReader,CertificateBA, CA_BA,ctype)=true then
     'msgbox ACSP.BA2STR(CertificateBA)
     call ACSP.Display_Certificate(CertificateBA)     
end if


The function FindCertificate searches all connected card reader for a specific certificate.

Function FindCertificate(ByVal SearchString As String, ByVal SearchFilter As SearchFilter, ByVal ctype As CertificateType, ByRef fingerprint As String, ByRef CertificateBA As Variant) As Long

Searchfilter can be of type:
 
The sample below will find the first non repudiation certificate which contains the String "Stefan Engelbert". It will return the card reader holding the card and the fingerprint of the certificate.

Const FreeText = 7
Const SignatureCertificate = 0

Dim ACSP As Object
Dim SearchString As String
Dim SearchFilter As Long
Dim FingerPrint As String
Dim CardReader As Long

SearchString = "Stefan Engelbert"
SearchFilter = FreeText
ctype = SignatureCertificate

Set ACSP = CreateObject("AloahaCSPCore.provider") 

CardReader = ACSP.FindCertificate(SearchString, SearchFilter, ctype, FingerPrint, vbNull)

If CardReader > -1 Then

          MsgBox "Found Certificate with Fingerprint: " + FingerPrint + " in Reader " + ACSP.ReaderName(CardReader)

End If

Set ASP = Nothing


Properties

FingerPrint_by_Reader returns the fingerprint of the certificate of the given card reader.

For example fingerprint = ACSP.FingerPrint_by_Reader(0,1) returns the fingerprint of the signature/authentication certificate of the first card reader.


Property publickeyBA retrieves the public key of a certificate. That can be required for public key encryption or manual signature validation.

Dim PublicKey() as byte
Dim PublicKeyString as strnig
Dim FingerPrint as string
Dim CType

Fingerprint = <Fingerprint of Certificate>
CType = Type of Certificate (0, 1 or 2)

PublicKey = ACSP.publickeyBA(Fingerprint, CType)
PublicKeyString=ACSP.BA2STR(PublicKey)





Aloaha Software / Knowledge Base / Smart Card API / Aloaha CSP API / Certificate Management

Freeware

Functions and Properties on this page are FREEWARE. No valid Aloaha License is required!
create PDF Software

Certificate Management

Any questions?
Aloaha Software - Certificate Management
ProductsKnowledge BaseShopSupportPress
Deutsche VersionEnglish version