Let's say that I have a python string:
string_full = """
-----BEGIN CERTIFICATE-----
GIBBERISH................
......................
........................
-----END CERTIFICATE-----
"""
After removing the first line, newlines, and last line I got something like this:
string = """ GIBBERISH .................................. """
What I'm trying to do is to get the Public Key from that certificate.
I was having a look at this post, but it seems that the string must be formated as string_full
but the real problem is that I'm reading that line from a user uploaded file (django), but since this file is structured by the Mexican Goverment, it would be really easy for me to calculate the public key from the string as shown in string
.
a
Got any ideas? I was having a look at M2Crypto
lib which implements a get_pukey
but it will only work on requests and I have no way to get this request from an external server.
Any help would be appreciated.