Hi
It seams that the web holds no example / help for creating PKCS12 blobs with
openssl. :)
What I'm done so far:
//sync_handle->rsa_key_0 keeps a valid RSA key read in with
PEM_read_RSAPrivateKey
EVP_PKEY *pkey = EVP_PKEY_new();
EVP_PKEY_set1_RSA(pkey, sync_handle->rsa_key_0);
X509 *x509 = X509_new();
X509_set_version(x509,2);
ASN1_INTEGER_set(X509_get_serialNumber(x509),0);
X509_gmtime_adj(X509_get_notBefore(x509),0);
int days = 365;
X509_gmtime_adj(X509_get_notAfter(x509),(long)60*60*24*days);
X509_set_pubkey(x509,pkey);
X509_NAME *name=NULL;
name=X509_get_subject_name(x509);
X509_NAME_add_entry_by_txt(name,"C",
MBSTRING_ASC, "CH", -1, -1, 0);
X509_NAME_add_entry_by_txt(name,"CN",
MBSTRING_ASC, "OpenSSL Group TEST", -1,
-1, 0);
X509_set_issuer_name(x509,name);
int stat = X509_sign(x509,pkey,EVP_md5());
PKCS12 *pkcs = PKCS12_create("test", "nice name", pkey, x509, NULL,
NID_pbe_WithSHA1And40BitRC4, NID_pbe_WithSHA1And3_Key_TripleDES_CBC, 0, 0, 0);
//pkcs always == 0
Is there a chance to get some error code / error response (why pkcs == 0)?
What's wrong with my code?
Thanks!
</jonas>______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]