c++ - boost asio exception: use_private_key_file: key values mismatch -


i'm using example server boost asio, , i'm failing run , getting error,

exception: use_private_key_file: key values mismatch

i'm changing absolutely nothing in program, except keys , port.

i'm willing use own key authority, , seems there's problem in library, it's not excluded doing fundamentally wrong, please assist.

in program, use following lines keys:

context_.use_certificate_chain_file("../sslkeys/server.crt"); context_.use_private_key_file("../sslkeys/server.key", boost::asio::ssl::context::pem); context_.use_tmp_dh_file("../sslkeys/dh512.pem"); 

and create these keys, following:

1- create certificate authority (ca)

openssl genrsa -aes256 -out ca.key 4096 openssl req -new -x509 -extensions v3_ca -key ca.key -out ca.crt -days 36500 

2- create server key , sign authority key

openssl genrsa -des3 -out server.key 2048 openssl x509 -req -days 3650 -in server.csr -signkey ../sslca/ca.key -out server.crt cp server.key server.key.secure openssl rsa -in server.key.secure -out server.key openssl dhparam -out dh512.pem 1024 

now when run server configuration, error... doing wrong?

if require additional information, please ask.

edit:

so checked keys suggested commands:

openssl rsa -noout -modulus -in server.key openssl req -noout -modulus -in server.csr openssl x509 -noout -modulus -in server.crt

and first 2 produced same key, while last 1 different. have confirm crt file created using

openssl x509 -req -days 3650 -in server.csr -signkey ../sslca/ca.key -out server.crt 

suggestions? mean if not matching key , certificate problem, signing method wrong! doing wrong?

according error output, first step try make sure certificate matches private key openssl commands. might done this,

openssl rsa -noout -modulus -in server.key openssl req -noout -modulus -in server.csr openssl x509 -noout -modulus -in server.crt 

if modulus same, means files matched, boost program. otherwise, there might file mix-up.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -