Using X.509 certificate with OpenSSL in iPhone App

1.3k Views Asked by At

I'm trying to figure out how to use the self compiled OpenSSL API to load an existing X.509 certificate (.crt) which I have included in Xcode's project structure.

I need a X509 object (from OpenSSL x509.h) which should be created/loaded from an existing file. Including the header works fine but I really can't find a way to load an existing certificate... There are sooo many methods in the x509.h but no sufficient documentation.

Thanks, Chris

1

There are 1 best solutions below

0
On BEST ANSWER

If you've read the character data into a char* s, something like

  BIO* bio = BIO_new_mem_buf((void*)s, -1);
  X509* cert = 0;
  PEM_read_bio_X509(bio, &cert, 0, NULL);
  ...
  X509_free(cert);
  BIO_free(bio);