I'm developing an application to sign and verify files.
The creation of the signature is done by a smartcardterminal. The signature must be verified on another computer, so I need a suitable file format to transport the signature. Therefore I found the CMS (PKCS#7) structure in the OpenSSL lib.
My problem is, that I found no way to fill the structure correctly by hand. It fails in the beginning.
I have the following values, that must be included in the structure:
- the signature (unsigned char*)
- the Public Key (managed to put it correctly into EVP_PKEY)
- the hashing algorithm (EVP_MD)
- all available certificates on the smartcard(all unsigned char*)
How do I fill the structure with these values?
After the structure is filled I'll save it with a file_BIO.
The EVP_sign and EVP_Verify functions are not useful in this case, because I don't have the private key and there is no way to read the private key from the smartcard.
So any help about this problem me would be appreciated?