Reputation: 323
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.
Upvotes: 0
Views: 527
Reputation: 98
I'm not sure why you are trying to get that string since to my knowledge most ssl functions will take the whole cert to verify.
Have you seen this post? It looks like what you want.
Hope that helps.
EDIT:
I think this example will help you understand what's every argument and in what format should it be.
Upvotes: 1