Create / Validate PKCS #7 Signature File

Sometimes it is essential to be able to sign any possible filetype. For example to be able to detect modifications or to sign legally binding a non PDF document.

PKCS7 Signatures can be easily created via the shell extension. Please see a flash video here.

Aloaha offers an easy to use API to use a supported smartcard to create such a PKCS7 signature.

Please find some sample code below:

Dim csp
Dim FileToBeSigned
Dim CardReader                  'Card Reader to be used. Can have a value from 0 to 9 
Dim CardPIN                         'holds the PIN of the Card - if empty string a dialog will pop up

FileToBeSigned = "d:\mymailer.exe"
CardReader = 2                 'for the 3rd connected reader
CardPIN = "123456"

Set csp = CreateObject("aloahacsp.aloaha_csp")

If csp.sign_file(CStr(FileToBeSigned), CLng(CardReader), CStr(CardPIN)) = true Then
          MsgBox "File Signed"
Else
          MsgBox "Problem"
End If

Set csp = nothing

Validation of PKCS7 Signature File

Please have a look below to learn how to use Aloaha to validate a PKCS7 Signature.


Dim csp
Dim SignedFile
Dim SigFilePATH
Dim Signers

SignedFile = "d:\mymailer.exe"
SigFilePATH = "d:\mymailer.exe.pkcs7"


Set csp = CreateObject("aloahacsp.aloaha_csp")

If csp.VerifyPKCS7File(CStr(SignedFile), CStr(SigFilePATH), true, signers) = true Then
          MsgBox "File Signed"
Else
          MsgBox "Problem"
End if

Set csp = nothing



Please ask...

Although we really tried hard, there are always questions left open. But perhaps somebody else had already put the same question?
Please check!

  • Thank you very much for your question "How do I open a PKCS7 file". The easiest way of opening the file is just to install our card connector and then right click on the PKCS7 file. Please note that the extension must be p7s or p7m. If you have further questins please contact info@aloaha.com
    Answered 06.07.2009
If not, please do not hesitate to send us your question.
We would be glad to answer it.

Aloaha Software