dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib

Update: As of December 2020 and beyond, brew switch does not work, so use the other answer by @angabriel: brew install rbenv/tap/[email protected] ln -sfn /usr/local/Cellar/[email protected]/1.0.2t /usr/local/opt/openssl Original Answer: Switch to an older openssl package brew switch openssl 1.0.2s Or, depending on your exact system configuration, you may need to switch to a different version. Check … Read more

create a trusted self-signed SSL cert for localhost (for use with Express/Node)

The answers above were partial. I’ve spent so much time getting this working, it’s insane. Note to my future self, here is what you need to do: I’m working on Windows 10, with Chrome 65. Firefox is behaving nicely – just confirm localhost as a security exception and it will work. Chrome doesn’t: Step 1. … Read more

Use OpenSSL RSA key with .Net

I am using openssl 0.9.6g and I have created public/private keypair using RSA_generate_key(). It gives me keys like: —–BEGIN RSA PUBLIC KEY—– … —–END RSA PUBLIC KEY—– I think what I am looking for is “how to convert rsa public key from pkcs#1 to x509 format. Yeah, .Net can consume some ASN.1/DER encoded keys, and … Read more

Why are the RSA-SHA256 signatures I generate with OpenSSL and Java different?

openssl dgst -sha256 < data.txt produces something like: (stdin)= b39eaeb437e33087132f01c2abc60c6a16904ee3771cd7b0d622d01061b40729 notice the (stdin)=‘? you don’t want that to be part of your hash, if you need to create a digest, use the -binary option. try using this to sign your data: openssl sha -sha256 -sign private.pem < data.txt This does everything you need. edit – … Read more

How to generate RSA private key using OpenSSL?

#include <openssl/rsa.h> #include <openssl/pem.h> const int kBits = 1024; const int kExp = 3; int keylen; char *pem_key; RSA *rsa = RSA_generate_key(kBits, kExp, 0, 0); /* To get the C-string PEM form: */ BIO *bio = BIO_new(BIO_s_mem()); PEM_write_bio_RSAPrivateKey(bio, rsa, NULL, NULL, 0, NULL, NULL); keylen = BIO_pending(bio); pem_key = calloc(keylen+1, 1); /* Null-terminate */ BIO_read(bio, … Read more

Differences between “BEGIN RSA PRIVATE KEY” and “BEGIN PRIVATE KEY”

See https://polarssl.org/kb/cryptography/asn1-key-structures-in-der-and-pem (search the page for “BEGIN RSA PRIVATE KEY”) (archive link for posterity, just in case). BEGIN RSA PRIVATE KEY is PKCS#1 and is just an RSA key. It is essentially just the key object from PKCS#8, but without the version or algorithm identifier in front. BEGIN PRIVATE KEY is PKCS#8 and indicates that … Read more

OpenSSL: PEM routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE [closed]

Since you are on Windows, make sure that your certificate in Windows “compatible”, most importantly that it doesn’t have ^M in the end of each line If you open it it will look like this: —–BEGIN CERTIFICATE—–^M MIIDITCCAoqgAwIBAgIQL9+89q6RUm0PmqPfQDQ+mjANBgkqhkiG9w0BAQUFADBM^M To solve “this” open it with Write or Notepad++ and have it convert it to Windows “style” … Read more

How can I transform between the two styles of public key format, one “BEGIN RSA PUBLIC KEY”, the other is “BEGIN PUBLIC KEY”

I wanted to help explain what’s going on here. An RSA “Public Key” consists of two numbers: the modulus (e.g. a 2,048 bit number) the exponent (usually 65,537) Using your RSA public key as an example, the two numbers are: Modulus: 297,056,429,939,040,947,991,047,334,197,581,225,628,107,021,573,849,359,042,679,698,093,131,908,015,712,695,688,944,173,317,630,555,849,768,647,118,986,535,684,992,447,654,339,728,777,985,990,170,679,511,111,819,558,063,246,667,855,023,730,127,805,401,069,042,322,764,200,545,883,378,826,983,730,553,730,138,478,384,327,116,513,143,842,816,383,440,639,376,515,039,682,874,046,227,217,032,079,079,790,098,143,158,087,443,017,552,531,393,264,852,461,292,775,129,262,080,851,633,535,934,010,704,122,673,027,067,442,627,059,982,393,297,716,922,243,940,155,855,127,430,302,323,883,824,137,412,883,916,794,359,982,603,439,112,095,116,831,297,809,626,059,569,444,750,808,699,678,211,904,501,083,183,234,323,797,142,810,155,862,553,705,570,600,021,649,944,369,726,123,996,534,870,137,000,784,980,673,984,909,570,977,377,882,585,701 Exponent: 65,537 The question then becomes how do we want to store these … Read more