From aamacher at inverse.ca Wed Feb 25 18:02:25 2015 From: aamacher at inverse.ca (Amacher Antoine) Date: Wed, 25 Feb 2015 12:02:25 -0500 Subject: [pyOpenSSL-Users] Pyopenssl pkcs12 to CER Message-ID: <54EE0021.4030504@inverse.ca> Hello guys, I am having trouble reading the .cer file after a conversion from .pkcs12 or .pem. I used as an original both(.pkcs12, .pem) and convert them to .cer from openssl command on my debian system, it works great I can read the certificate with openssl command. Now when I tried to do the same with pyopenssl, the conversion from .pkcs12 to .pem works fine my file is readable, on the other hand the .pem to .cer or .pkcs12 to .cer doesnt work. I can't open my .cer file on Windows(which is my purpose and I don't want to use openssl for windows) or can't read it from openssl.(I included my privatekey in every case and also try without it) I made some search on the error message I got from openssl: unable to load certificate 140213359912616:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1319: 140213359912616:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:381:Type=X509_CINF 140213359912616:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:751:Field=cert_info, Type=X509 And the lead which is most probable would be that I tried to open the file with this command 'openssl x509 -in mycert.cer -inform DER -text' where I should work around using base64 instead of X509, while I am digging through this I'd like to know if I can convert from .pem or .pkcs12 to be a .cer with pyopenssl and get a readable file. Thanks, -- Antoine Amacher aamacher at inverse.ca :: +1.514.447.4918 *130 :: www.inverse.ca Inverse inc. :: Leaders behind SOGo (www.sogo.nu) and PacketFence (www.packetfence.org)