With Aloaha it is possible to save the PIN(s) of the Smart Card Certificate(s) into a memory area of your machine.
This is very useful for batch signatures. It makes also working with encryption certificates much easier. Who has not expierenced that email applications do not cache the decrypted email and stay asking for the card pin whenever the email is read.
There are two possibilites to cache a PIN. The suggested way is to address the PIN via the Thumbprint of the Certificate. Please find below a small script to demonstrate that feature:
Dim pdf
Set pdf = CreateObject("aloahapdf.edit")
'the following lines set the PIN for 3 different certificates!
Call pdf.set_CardPIN("123456", replace("83 0f cb 40 cc a7 2a bf 0d 73 85 84 4f 01 35 61 36 b9 d6 a8"," ",""))
Call pdf.set_CardPIN("123456", replace("40 c4 0c 6d 6e c1 e4 e1 00 89 ac 7f ad 7a 5a 0e b5 2a 65 29"," ",""))
Call pdf.set_CardPIN("123456", replace("25 f8 31 3e e9 c9 18 4e 8f dd 08 ac 4c 9c 6f 31 be d5 47 d3"," ",""))
set pdf = nothing
Reader based PIN Caching
Sometimes it is more usefull to assin a PIN to a specific certificate of a specific card reader. For example when accessing the certificate native from within the Aloaha PDF tools.
First you need to find out the Name of your Card Reader:
dim csp
set csp = createobject("aloahacsp.provider")
'gets reader name for reader 0 (first reader)
reader=csp.ReaderName(0)
set csp = nothing
Now you need to know for which certificate of the card the PIN should be cached in memory:
Dim PDF
set pdf = createobject("aloahapdf.edit")
'sets PIN for first Certificate (0) in Card Reader "Reader"
Call pdf.set_CardPIN("123456",Reader + ":" + "Cert" + CStr(0))