Hi,

I would like to use openssl library in my iOS application (Objective-C) to generate certificate signing request.

If I wanted to use openssl application in linux I would write something like that:

openssl req -new -newkey rsa:2048 -nodes -out common_name.csr -keyout common_name.key -subj "/C=pl/ST=state/L=city/O=organization/OU=department/CN=common_name"

However, I have to use openssl as a library. Can I ask for some hints on how to do it or what documents should I read in the first place? Do I have to separately create public/private keys and then use them to create CSR?

I found out that there a few functions which are responsible for creating CSR:

int PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x);
int PEM_write_X509_REQ(FILE *fp, X509_REQ *x);
int PEM_write_bio_X509_REQ_NEW(BIO *bp, X509_REQ *x);
int PEM_write_X509_REQ_NEW(FILE *fp, X509_REQ *x);

1. I assume that after calling PEM_write_X509_REQ_NEW(), file fp will contain csr only, like this:

-----BEGIN CERTIFICATE REQUEST-----
...
-----END CERTIFICATE REQUEST-----

2. is there any info on how to initialize X509_REQ object?

It's a struct, that looks like this:

typdef struct X509_req_st {
        X509_REQ_INFO* req_info;
        X509_ALGOR* sig_alg;
        ASN1_BIT_STRING* signature;
        int references;
} X509_REQ;

As I look through the dependencies, there are a lot of different classes. Do I have to initialize all of them manually or is there a better way?

I would be very grateful for any help!

Greetings,

Kacper86


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to