Ang.: [erlang-questions] public_key:pem_decode/1 and public_key:verify/4
jocke@tail-f.com
jocke@REDACTED
Wed Jan 19 20:20:46 CET 2011
The standard doesn't say anything about the PEM format itself.
----- Reply message -----
Från: "Joakim G." <jocke@REDACTED>
Datum: ons, jan 19, 2011 16:42
Rubrik: [erlang-questions] public_key:pem_decode/1 and public_key:verify/4
Till: <erlang-questions@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. :-)
I will see if I can find more info on this.
Cheers
/Jocke
On 2011-01-19 14:21, Ingela Andin wrote:
> Hi!
>
> All possible PEM-types are not supported by public_key, the currently
> supported types are mainly a result of what we need
> for the ssl-application. More types may of course be added if there is
> a need. You are welcome to contribute PEM-types that may be of common
> use.
>
> If you want the public part of your own rsa-key it is included in the
> private-key and you can decode that file with public_key and
> pick out the public part.
>
> Regards Ingela Erlang/OTP team - Ericsson AB
>
>
> 2011/1/19 caox <caox@REDACTED>:
>> Maybe the asn1 type of your key file is not supported by public_key. You can check it and use openssl to convert the key format.
>>
>> 在 2011-1-19,下午5:23, Joakim G. 写道:
>>
>>> Hi all,
>>> It seems that public_key:pem_decode/1 can't decode public
>>> keys.
>>>
>>> I wanted use public_key:verify/4 to verify a digital signature
>>> and for that I used public_key:pem_decode/1 to extract the
>>> public key.
>>>
>>> 26> {ok, Bin} = file:read_file("key.pub").
>>> {ok,<<"-----BEGIN RSA PUBLIC
>>> KEY-----\nMIGJAoGBAKhhZ8RrKaA0RWhjXJlSpTHd7/h6Luww9qeyUkEqBQyiCooZZGCYNle5C9TfRVJDUuxz"...>>}
>>> 27> rp(Bin).
>>> <<"-----BEGIN RSA PUBLIC
>>> KEY-----\nMIGJAoGBAKhhZ8RrKaA0RWhjXJlSpTHd7/h6Luww9qeyUkEqBQyiCooZZGCYNle5\nC9TfRVJDUuxzigvXuTh0tlba+9AyIe2hxAztjs43pSKy5VnnJlSjMBVDay8XmNjh\nlUxid/ZV2hDkKlwHDCnZjdZpeXqdtGbZ7o3N7wOBzJSRQ7kqzQHXAgMBAAE=\n-----END
>>> RSA PUBLIC KEY-----\n">>
>>> ok
>>> 28> public_key:pem_decode(Bin).
>>> []
>>>
>>> That was a surprise.
>>>
>>> Cheers
>>> /Jocke
>>>
>>> ________________________________________________________________
>>> 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
>>
>>
>
> ________________________________________________________________
> 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