python - "key values mismatch" when using context.use_certificate_chain_file -


when using context.use_certificate_chain_file key error (openssl.context python). error is:

traceback (most recent call last):   file "/home/user/public_html/application.py", line 363, in <module>     context.use_privatekey_file('/etc/ssl/private/' + hostname + '.key') openssl.ssl.error: [('x509 certificate routines', 'x509_check_private_key', 'key values mismatch')] 

it saying key values mismatch, wouldn't think chain affect that.

if comment context.use_certificate_chain_file line, works (but gives ssl verification error in browser).

here snippet of code:

context = openssl.context(openssl.sslv23_method) context.set_options(openssl.op_no_sslv2) context.set_options(openssl.op_no_sslv3) context.use_certificate_file('/etc/ssl/certs/' + hostname + '.crt') context.use_certificate_chain_file('/etc/ssl/certs/' + hostname + '.cabundle') context.use_privatekey_file('/etc/ssl/private/' + hostname + '.key') context.set_cipher_list(':'.join(supported_ciphers)) 

any ideas why giving error?

any ideas why giving error?

the error propagated openssl. error 0x0b080074:

$ openssl errstr 0x0b080074 error:0b080074:x509 certificate routines:x509_check_private_key:key values mismatch 

based on ssl install problem - “key value mismatch” (but match?), have 1 of 2 problems.

first, private key not match public key in certificate. second, certificate_chain_file missing intermediate certificates required build valid path server's certificate root. here, root ca signed certificate.

so fix either (1) ensure public/private key pair in fact pair, or (2) include necessary intermediate certificates in chain file.

without knowing private key ('/etc/ssl/private/' + hostname + '.key'), server certificate ('/etc/ssl/certs/' + hostname + '.crt') or contents of chain file ('/etc/ssl/certs/' + hostname + '.cabundle'), can't give more details on how fix it.


you can provide server's certificate with:

cat '/etc/ssl/certs/' + hostname + '.crt' | openssl x509 -text -noout 

you can provide chain file cat'ing. 3 or 4 pem encoded certificates concatenated together:

cat `'/etc/ssl/certs/' + hostname + '.cabundle'` 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -