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

Compile OpenSSL with the ‘shared’ option?

Same problem here, BUT usually Makefiles will consider environment variables for compiler or linker options. So, if you place the -fPIC option before calling the configure script, it should take care of it. You can do it with: CFLAGS=-fPIC ./config shared –prefix=/your/path or export CFLAGS=-fPIC ./config shared –prefix=/your/path It worked for me.

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

Couldn’t require openssl in ruby

Note: Calls to rubygems.org are deprecated – proceed with caution! I had the same issue on Mac OSX after also building ruby2.1.0p0 from the source. I already had openssl installed. It appears that the reference in gems needed refreshing. I ran: gem source -r https://rubygems.org/ to remove followed by gem source -a https://rubygems.org/ to read … Read more

show entire certificate chain for a local certificate file

For local certificates you can see the subject and direct issuer using: openssl x509 -noout -subject -issuer -in test.crt subject= /C=US/ST=Utah/L=SLC/O=My Organization/CN=my.server.com issuer= /C=BE/O=GlobalSign nv-sa/CN=GlobalSign Organization Validation CA – SHA256 – G2 But that doesn’t indicate if the certificate includes any intermediate certificates or the full chain of trust. The verify command you listed will … Read more

Unable to load certificates when trying to generate pfx file

I get the error: unable to load certificates myserver.crt needs to be in PEM format. Does it have —– BEGIN CERTIFICATE —– and —– END CERTIFICATE —–? myserver.crt should actually be a chain of certificates (and not just the one server certificate). The chain should include all intermediate certificates needed by the client to verify … Read more

What does “e is 65537 (0x10001)” mean?

The “e” is the public exponent, in openssl genrsa, you can use the option -F4 or -3 to choose between 65537 and 3. For information on public exponent, you may take a look on this question: https://security.stackexchange.com/questions/2335/should-rsa-public-exponent-be-only-in-3-5-17-257-or-65537-due-to-security-c

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)