I am trying to code in C on OS X (El Capitan) and need to use OpenSSL. OS ships with version 0.9.8zh 14 Jan 2016
.
I used homebrew to upgrade and install openssl (got version 1.0.2h) but am unable to link it correctly to use it. This is what is did:
brew update
brew install openssl
brew link --force openssl
which gave me error saying
Warning: Refusing to link: openssl
.
My path references /usr/local/bin
as the first one.
Ran this command:
ln -s /usr/local/Cellar/openssl/1.0.2j/include/openssl /usr/local/include/openssl
(found this solution here: Openssl with El Capitan among other places)
got no error output, so I assumed this worked. But..
which openssl
gives me this output: /usr/local/bin/openssl
openssl version
gives me this output: OpenSSL 0.9.8zh 14 Jan 2016
All I'm trying to do is run some CLI commands/ write some C code edited in plain vi
editor, compiled using gcc
. I am including openssl in header files using
#include <openssl/sha.h>
#include <openssl/ripemd.h>
Also, the command I am running on CLI which led me to this path was this (if that helps):
openssl dgst -sha256 -sign ec-priv.pem ex-message.txt >ex-signature.der.
Gives me an error:
EVP_SignFinal:wrong public key type.
Googling led me to understand it's cause of an old OpenSSL version which I need to update.
Any ideas on how to proceed here?
openssl version
showed me the correct version. SO it got linked properly and i was just not seeing the correct version as i was running it all in old shell. I am putting this here as answer as i am not allowed to comment. Couldn't find any other way to respond to you. If you put this as an answer, I will accept it.