On Thu, Jun 17, 2010, Niels Stevens wrote:
> Hey I'm want to verify a S/MIME I stored in a INI file. I acces this ini file
> using QSettings, reading the PKCS7 isn't a problem. I checked the smime with
> dumpasn1 and their where no problem. I tested the verifiy code using boost
> libraries and generated a S/MIME with the same certificate I used for the
> S/MIME stored in the ini file and then the S/MIME is verified.
>
> Why can't I verify a stored S/MIME ?
>
> This is the code I use :
>
> //***************** Check if signing is verified ****************
> std::string
> license_key(iniFile.value("license/LicenseKey").toString().toAscii());
>
> if (!(rootStore = create_store()))
> {
> KILL_STORE(rootStore);
> return false;
> }
>
> if (!(in = BIO_new(BIO_s_mem())) ||
> !(BIO_puts(in, license_key.c_str())))
> {
> KILL_BIO(in);
> KILL_STORE(rootStore);
> return false;
> }
>
> //used to set mem bio react like file bio
> BIO_set_mem_eof_return(in, 0);
>
> if (!(pkcs7 = SMIME_read_PKCS7(in, &pkcs7_bio)))
> {
> KILL_BIO(in);
> KILL_BIO(pkcs7_bio);
> KILL_STORE(rootStore);
> return false;
> }
>
> BIO *content_bio = BIO_new(BIO_s_mem());
> cout << "validate allmowts everything" << endl;
>
> if (PKCS7_verify(pkcs7, NULL, rootStore, pkcs7_bio,
> content_bio, 0) != 1)
> {
> }
>
That doesn't help much. Which part is returning the error? What format is the
S/MIME message in your .ini file? It is unlikely to be S/MIME format and could
be base64 encoded instead.
Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]