Loading a PKCS#1 public key using M2Crypto

Marc Aymerich glicerinu at gmail.com
Fri Jan 18 10:13:01 CET 2013

On Fri, Jan 18, 2013 at 12:10 AM, Piet van Oostrum <piet at vanoostrum.org> wrote:
> Marc Aymerich <glicerinu at gmail.com> writes:
>> Thank you very much Piet,
>> I'm just starting to grasp these cryptography related concepts and your code is helping me a lot to understand how to handle these keys in a low level.
>> I'm updating my code incorporating your new contribution!
>> Just to let you know, during my previous research I had found a python-Crypto related solution that also uses DER and ASN.1 [1], but it uses a different approach (I guess). I suspect that this approach is also possible with M2Crypto because it has a method for constructing RSA keys [2].
>> [1] http://stackoverflow.com/a/10574723
>> [2] http://www.heikkitoivonen.net/m2crypto/api/M2Crypto.RSA-module.html#new_pub_key
> new_pub_key could be used but then you would have to do an ASN.1 parse
> of the DER format of your key to get the n and e values. AFAICT M2Crypto
> doesn't have methods to do this, so you would need to use one of the
> python ASN.1 libraries (or write that part yourself).

Thanks for the clarifications,

Just sharing the document I'm reading right now, in case anyone found
this thread and want to know more about ASN.1 and DER:



More information about the Python-list mailing list