Created
May 6, 2018 07:29
-
-
Save armsp/db57de8e48578b25965cef80cfa6cfd5 to your computer and use it in GitHub Desktop.
Automate certificate conversion from .cer to .pem via openssl using Python. An automated solution for Docker issue error x509: certificate signed by unknown authority
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
path = "C:/Users/username/path/to/your/folder" | |
file_list = os.listdir(path) | |
file_list_no_extension = [os.path.splitext(x)[0] for x in file_list] | |
for i,j in zip(file_list,file_list_no_extension): | |
command_list = [] | |
command1 = "openssl x509 -inform der -in " | |
command2 = " -out " | |
command3 = ".pem" | |
command_list.append(command1) | |
command_list.append(i) | |
command_list.append(command2) | |
command_list.append(j) | |
command_list.append(command3) | |
final_command = "".join(command_list) | |
os.syatem(final_command) | |
#print(final_command) | |
#openssl x509 -inform der -in certificate.cer -out certificate.pem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Refer this SO post for details. This is what i have automated https://stackoverflow.com/questions/31205438/docker-on-windows-boot2docker-certificate-signed-by-unknown-authority-error