SSL certificate parsing?
pythonnutter at gmail.com
Tue Jan 6 08:11:40 CET 2009
If no one answers, the way I do my work with certificates is I just
wrap OpenSSL myself by doing a popen call (probably now should be
using subprocess for any future scripts I write). I then redirect the
output that normally goes to the shell window into a buffer then I
search/slice out the fields using standard Python string searching.
You could go to regex's but its overkill in my opinion if you can
simply do standard string searches. The buffer always follows a set
pattern so you are not going to have to search wildly varying output
from OpenSSL call to OpenSSL call.
I looked at PyOpenSSL but I have country specific OIDs that are
standard by not in the default ISO standard. Most libraries fall short
on supporting what I need and it was brain dead easy to just call
OpenSSL in my script directly and capture the output for parsing.
Its up to you what you want to do with the extracted information, you
could just populate a dict with it and perhaps shelve or store it for
later use if you have such a need or as in my case since I only
process the certificates once I just use the parsed information
immediately in my scripts logic decision tree(s) to create various
2009/1/5 Taras Ivashchenko <naplanetu at gmail.com>:
> Hello, list!
> I use pyopenssl  for checking SSL certificates.
> And one of such checks is if given certificate is self-signed.
> I can do it using values of X509v3 extensions: the subject key identifier and
> the authority key id:
> X509v3 Subject Key Identifier:
> X509v3 Authority Key Identifier:
> I read documentation of pyOpenSSL but I didn't find way how to grub
> this information
> from certificate using, for example, methods of X509 object.
> May be there is another way to parse SSL certificates?
> I will be glad to get ever text version of given SSL certificate :)
>  http://pyopenssl.sourceforge.net/
> P.S. I already wrote to pyopenssl mailing list, but there is now
> answer there :(
> Тарас Иващенко (Taras Ivashchenko)
> "Software is like sex: it's better when it's free.", - Linus Torvalds.
More information about the Python-list