hohl / MIHCrypto

OpenSSL wrapper for Objective-C [cryptography]
MIT License
341 stars 68 forks source link

How to get public key in real time #14

Closed hdoria closed 7 years ago

hdoria commented 9 years ago

I can't add the certificate in my application bundle. I need to download the SSL certificate and extract the public key in real time. Is there a way to do this?

hohl commented 9 years ago

If the key is in OpenSSL compatible PKEY format (which I guess is the case in most scenarios), yes it is, but you need to download the key yourself. There are unlimited ways of how and where to download keys and because of that it belongs to your application to implement it.

A good library to download HTTP files is https://github.com/AFNetworking/AFNetworking

akhilstanis commented 9 years ago

If it is just about extracting public key from a certificate, you can do that easily by using method X509_get_pubkey which is defined in openssl/x509.h. MIHCrypto currently doesn't implement a wrapper for OpenSSL's X509 structure, may be we should implement it. :)

hohl commented 9 years ago

X509 is a very important part of OpenSSL and I should add it to my ToDo list.

akhilstanis commented 9 years ago

Will be happy to help you implement it. Can you add TODO.md or update README to include the todo.

hohl commented 9 years ago

I prefer to use to GitHub issues as ToDo list. At the moment the only task on my ToDo list is to add elliptic curve cryptography support.