[erlang-questions] public_key:pem_decode/1 and public_key:verify/4

Joakim G. jocke@REDACTED
Thu Jan 20 23:41:10 CET 2011


lol. pubkey_pem.erl

/Jocke

On 2011-01-20 23:40, Joakim G. wrote:
> I updated pubkey_pem.html a tiny little bit and it seems to
> work:
> 
> jocke@REDACTED:~/installs/otp_src_R14B01/lib/public_key/src$ diff -bwt
> pubkey_pem.erl.orig pubkey_pem.erl
> 157a158,159
>> join_entry([<<"-----END RSA PUBLIC KEY-----", _/binary>>| Lines],
> Entry) ->
>>     {lists:reverse(Entry), Lines};
> 212a215,216
>> pem_start('RSAPublicKey') ->
>>     <<"-----BEGIN RSA PUBLIC KEY-----">>;
> 221a226,227
>> pem_end(<<"-----BEGIN RSA PUBLIC KEY-----">>) ->
>>     <<"-----END RSA PUBLIC KEY-----">>;
> 232a239,240
>> asn1_type(<<"-----BEGIN RSA PUBLIC KEY-----">>) ->
>>     'RSAPublicKey';
> 
> Thanks
> /Jocke
> 
> On 2011-01-20 10:37, Ingela Andin wrote:
>> Hi again,
>>
>> The PKCS-1 asn-1 spec is part of public key. PEM-files are mainly
>> base64-encoded  asn1 DER data.
>> Pem files looks something like this:
>>
>> 	<text>
>> 	-----BEGIN SOMETHING-----<CR><LF>
>> 	<Base64 encoding line><CR><LF>
>> 	<Base64 encoding line><CR><LF>
>> 	...
>> 	-----END SOMETHING-----<CR><LF>
>> 	<text>
>>
>> Adding support for the something = RSA PUBLIC KEY should be fairly
>> simple as the ASN1- spec is alredy in place.
>>
>> 2011/1/19 Joakim G. <jocke@REDACTED>:
>>> Thanks, I see.
>>>
>>> I'm using keys as defined in:
>>> https://gitweb.torproject.org/tor.git?a=blob_plain;hb=HEAD;f=doc/spec/tor-spec.txt
>>>
>>> That is:
>>>
>>> "For a public-key cipher, we use RSA with 1024-bit keys and a fixed
>>> exponent of 65537.  We use OAEP-MGF1 padding, with SHA-1 as its digest
>>> function.  We leave the optional "Label" parameter unset. (For OAEP
>>> padding, see ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.pdf)"
>>>
>>> I only have the public keys to work with. Not a surprise. :-)
>>
>> No not really, but you never know, with time I learnt not to take
>> anything for granted  ;)
>>
>>>
>>> I will see if I can find more info on this.
>>
>> [...]
>>
>> I will put it on the wish-list, but we have got a lot of other things
>> on our table so a contribution
>> will proably speed things up.
>>
>> Regards Ingela Erlang/OTP team - Ericsson AB
>>
>> ________________________________________________________________
>> erlang-questions (at) erlang.org mailing list.
>> See http://www.erlang.org/faq.html
>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>>
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
> 


More information about the erlang-questions mailing list