Hi NG,

I want to write a C++ program, that imports a p12-Certificate into the
security manager.

So far, here is my source:
#include <iostream>
#include "cert.h"
#include "certdb.h"

using namespace std;

int main(int argc, char** argv)
{

CERTCertDBHandle *certdb = CERT_GetDefaultCertDB();
SECCertUsageEnum dummy;
unsigned int ncerts;
SECItem **derCerts;
CERTCertificate ***retCerts;

SECStatus rv = CERT_ImportCerts(certdb,
        dummy,
        ncerts,
        derCerts,
        retCerts,
        0,
        0,
        "Karl"
        );
return 0;
}

After running the program, I want to find my certificate in my Mozilla
Security Manager. The certifactes are stored in the cert7.db, istn't it?
Correct me, please!
Okay, with CERT_GetDefaultCertDB() I got the handle to my cert7.db. With
CERT_ImportsCerts, I can import my p12 certificate into this database,
which is responsible for holding all the certficates shown in the security
manager.

So can anybody give me a hint how to continue writing? I haven't found the
types SECItem, CERTCertificate. The only thing to do is to set the
variables to the certificate I want to import. If it is so, how can I do
this.

Sorry, for these newbie-questions.

Best Regards
Karl

Reply via email to