5

I'm trying to use OpenSSL module in Python for certificate validation.

I have window's openssl command as:

openssl verify -partial_chain -CAfile Intermediate.pem UserCert.pem

Will you please suggest me equivalent of this in Python?

Requirement: This needs to be done by OpenSSL or any Python3 module. Use of os.system will solve the problem but this won't satisfy the requirement.

Bogota
  • 401
  • 4
  • 15
  • If you have WSL try `import os` newline `os.system('cmd /c "bash -c openssl verify -partial_chain -CAfile Intermediate.pem UserCert.pem"')` This will create a cmd instance that accesses your WSL to execute the `OpenSSL` bash command in a cmd window then close it. To keep it open use `/k` instead of `/c`. To see if this works, first open a command prompt and run the command `bash -c openssl verify -partial_chain -CAfile Intermediate.pem UserCert.pem` and see if it returns what you want then try running it from python. – Nico Nekoru Jun 22 '20 at 17:00
  • Then my comment is not what you are looking for. Can you put more detail in your question detailing your constraints and other limitations then? Accessing WSL with `os.system` will allow you to use `OpenSSL` – Nico Nekoru Jun 22 '20 at 17:04
  • Can you call cmd? https://stackoverflow.com/questions/21900884/running-openssl-system-call – Nico Nekoru Jun 22 '20 at 17:08
  • I want this to do be done completely in Python. Nothing from cmd or os. I need proper function to do this. – Bogota Jun 22 '20 at 17:11
  • Does [this](https://stackoverflow.com/questions/30602843/how-to-import-openssl-in-python/30602906) answer your question? – Nico Nekoru Jun 22 '20 at 17:13
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/216447/discussion-between-neko-musume-and-bogota). – Nico Nekoru Jun 22 '20 at 17:14

0 Answers0