p7s / p7m Signature File Generation

Once Aloaha is installed it is possible with just a right click to create for any filetype p7m or p7s signature files. The APIs used to generate those files are public and are explained below.

PKCS7 Signatures can also created via the shell context. Please click here to see a flash movie.

Object aloahacsp.PKCS7

To be able to use the PKCS #7 functions you need to create first the Aloaha PKCS7 Object. In VBS it can be done for example with the commands:

dim PKCS7
set PKCS7 = CreateObject("aloahacsp.PKCS7")

create_P7x

This function creates automatically the p7m / p7s files. The filename will be created automatically from the original filename.

VBS example:

dim PKCS7
dim result

dim tobesigned
dim uniquecontainername
dim attached
dim overwrite

set PKCS7 = CreateObject("aloahacsp.PKCS7")

'defines the certificate to be used
'in case uniquecontainername is not known it is also possible to use the Hash/Fingerprint of the certificate to be used.
'in case an Aloaha supported smart card is used the value can be also a value between 0 for the first reader to 9 for the last reader.
uniquecontainername="23434_234234"

attached = true  ' defines if p7m or p7s

overwrite = true ' will overwrite an existing result file

'result will contain the resulting filepath
'empty result means error

result = PKCS7.create_P7x(cstr(tobesigned), cstr(UniqueContainerName), cbool(attached),cbool(overwrite)) 


set PKCS7 = nothing

validate_P7x

This function validates p7m / p7s files.

VB6 example:

dim PKCS7 as object
dim result as variant   ' will contain the original file
dim filename as string
dim showcert as boolean
dim CertifciateB64 as Variant 'will contain the signers certificate

set PKCS7 = createobject("aloahacsp.PKCS7")

filename = "c:\letter.doc.p7m"
showcert = true ' instructs the API to display the signing  Certificate


result = PKCS7.validate_P7x(cstr(filename), cbool(showcert), CertifciateB64)

set PKCS7 = nothing

Licensing

Depending on the certificate used for signing a valid Aloaha CSP license might be required for these APIs. In case a software certificate is used these APIs are free to be used.



Please ask...

Although we really tried hard, there are always questions left open.

Please send us your question.
We would be glad to answer it.

Aloaha Software