0

I am having an issue trying to verify the certificate. Looking at the python3 documentation it appears that I am doing everything correctly.

import requests
requests.get('example.com/token',cert('/myfile.pfx','mypasscode'))

I am also using OpenSSL 1.0.2p and TLS 1.2. The server does not allow lower than 1.2.

I am getting the following error OpenSSL.SSL.Error: [('PEM routines', 'PEM_read_bio', 'no start line'), ('SSL routines', 'SSL_CTX_use_certificate_file', 'PEM lib')]

newdeveloper
  • 534
  • 3
  • 17
  • It is unclear what you are trying to do. Your title suggests that it is about validating the certificate but the error is about using a local pfx file as certificate. In any case, you need to use PEM files. – Steffen Ullrich May 18 '20 at 14:44
  • I am probably using the incorrect terminology. However I am trying to connect to `example.com/token` to receive an token. I have managed to do this in perl using the `lwp` module. `my $ua = LWP::UserAgent->new ( ssl_opts => { SSL_cert_file => $certfile, SSL_passwd_cb => sub {$pass}, SSL_cipher_list => '', });` I was trying to achieve the same using python – newdeveloper May 18 '20 at 17:24
  • In this case the duplicate fits your question. PFX is supported in newer versions of IO::Socket::SSL in Perl. In Python you need to use PEM though. See [Converting pfx to pem using openssl](https://stackoverflow.com/questions/15413646/converting-pfx-to-pem-using-openssl) for how to convert the PFX. – Steffen Ullrich May 18 '20 at 19:01
  • Thanks. I will have to do the converting. I wasn't sure because I don't do network programming but am learning on the fly. – newdeveloper May 18 '20 at 20:19

0 Answers0