clearhaus / aes256gcm_decrypt

Decrypt AES256GCM-encrypted data in Apple Pay Payment Tokens.
MIT License
10 stars 1 forks source link

Gem install fails for ruby v2.1.7, openssl on Mac OSX 10.13 #12

Open rwdaigle opened 6 years ago

rwdaigle commented 6 years ago

I tried installing this gem and hit the following error:

$ gem install aes256gcm_decrypt
Building native extensions.  This could take a while...
ERROR:  Error installing aes256gcm_decrypt:
    ERROR: Failed to build gem native extension.

    /Users/ryan/.rbenv/versions/2.1.7/bin/ruby extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling aes256gcm_decrypt.c
aes256gcm_decrypt.c:5:10: fatal error: 'openssl/evp.h' file not found
#include <openssl/evp.h>
         ^~~~~~~~~~~~~~~
1 error generated.
make: *** [aes256gcm_decrypt.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/ryan/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/aes256gcm_decrypt-0.0.2 for inspection.
Results logged to /Users/ryan/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-15/2.1.0-static/aes256gcm_decrypt-0.0.2/gem_make.out

This is probably a local openssl version issue. I'm on Mac OSX 10.13.4 (High Sierra) and my version is listed as:

$ openssl version
LibreSSL 2.2.7

I have confirmed I have the latest openssl headers via brew reinstall openssl. Thoughts?

mt-clearhaus commented 6 years ago

Maybe brew unlink openssl && brew link openssl --force ? Inspired by https://stackoverflow.com/questions/32960032/nginx-cannot-find-openssl-development-headers and https://superuser.com/questions/1089390/how-to-install-libssl-dev-libffi-dev-on-mac-os .

Does evp.h exist somewhere in your filesystem?

If you succeed installing the gem, note that using a potentially "old" OpenSSL/LibreSSL might mean trouble; see https://github.com/clearhaus/aes256gcm_decrypt/issues/11#issuecomment-386010395 .

mt-clearhaus commented 6 years ago

@rwdaigle Any news?

tibbon commented 5 years ago

I encountered this problem. No amount of installing and uninstalling with brew would work. This did however:

cd /usr/local/include
ln -s ../opt/openssl/include/openssl .
yoni-abtech commented 5 years ago

One small note to add. For my configuration /usr/local/opt/openssl had a version tag in the symlink / directory name so it was /usr/local/opt/openssl@1.1 instead. To see if this is the case for you, run ls -la /usr/local/opt/openssl* and check the path. If there's nothing there, then openssl probably hasn't been installed yet.

In my case, I had to do the following:

cd /usr/local/include
ln -s ../opt/openssl\@1.1/include/openssl .