[erlang-questions] Dealing with public/private keys stored in*.pem files

Daniel Kwiecinski <>
Thu Jan 31 16:30:55 CET 2008


There is no such function 'decode_rsa_keyfile' at all in 'ssl_pkix' module
in erts v5.5.5

Eshell V5.5.5  (abort with ^G)
1> m(ssl_pkix).
Module ssl_pkix compiled: Date: June 11 2007, Time: 17.57
Compiler options:  [{d,'VSN',"3.1.1.1"},

{cwd,"/ldisk/daily_build/otp_prebuild_r11b.2007-06-11_19/otp_src_R11B-5/lib/ssl/src"},

{outdir,"/ldisk/daily_build/otp_prebuild_r11b.2007-06-11_19/otp_src_R11B-5/lib/ssl/src/../ebin"},

{i,"/ldisk/daily_build/otp_prebuild_r11b.2007-06-11_19/otp_src_R11B-5/lib/kernel/src"},

{i,"/ldisk/daily_build/otp_prebuild_r11b.2007-06-11_19/otp_src_R11B-5/lib/ssl/src/../include"},
                    warn_unused_vars,
                    debug_info]
Object file: /sw/lib/erlang/lib/ssl-3.1.1.1/ebin/ssl_pkix.beam
Exports:
         decode_cert/1
         decode_cert/2
         decode_cert_file/1
         decode_cert_file/2
         module_info/0
         module_info/1
ok

:-(    Daniel

2008/1/31, Trevor Woollacott [ MTN - Innovation Centre ] <
>:
>
>  Hi,
>
>
>
> Ssl_pkix:decode_rsa_keyfile is returning undefined because it requires two
> parameters, namely Key File and Password
>
>
>
> Trevor
>
>
>  ------------------------------
>
> *From:*  [mailto:
> ] *On Behalf Of *Daniel Kwiecinski
> *Sent:* Thursday, 31 January 2008 04:12 PM
> *To:* Jakob Cederlund
> *Cc:* 
> *Subject:* Re: [erlang-questions] Dealing with public/private keys stored
> in*.pem files
>
>
>
> Eshell V5.5.5  (abort with ^G)
> 1> ssl_pkix:decode_rsa_keyfile("public.pem").
> ** exited: {undef,[{ssl_pkix,decode_rsa_keyfile,["public.pem"]},
>                    {erl_eval,do_apply,5},
>                    {shell,exprs,6},
>                    {shell,eval_loop,3}]} **
>
> =ERROR REPORT==== 31-Jan-2008::14:11:10 ===
> Error in process <0.31.0> with exit value:
> {undef,[{ssl_pkix,decode_rsa_keyfile,["public.pem
> "]},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}
>
> 2> ssl_pkix:decode_cert_file("public.pem", [pem]).
>
> =ERROR REPORT==== 31-Jan-2008::14:11:22 ===
> Error in process <0.33.0> with exit value:
> {{badmatch,{ok,[]}},[{ssl_pkix,decode_cert_file,2},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}
>
> ** exited: {{badmatch,{ok,[]}},
>             [{ssl_pkix,decode_cert_file,2},
>              {erl_eval,do_apply,5},
>              {shell,exprs,6},
>              {shell,eval_loop,3}]} **
>
> :-(
>
> 2008/1/31, Jakob Cederlund <>:
>
> Hi,
> there is not yet a public api for this in OTP. However, the undocumented,
> unsupported function ssl_pkix:decode_rsa_keyfile/2 does just this. It reads
> a .pem keyfile and returns a record with exponent and modulus, and other
> fields. It is unsupported, so it might be moved (or even removed) in future
> releases of OTP.
> /Jakob
>
>
> Daniel Kwiecinski wrote:
>
> Hi,
>
>    As far as I know the crypto module (app) handles rsa's private keys as
> a list of two binaries (exponent and modulus). How can I obtain these from
> base64 encoded *.pem files?
>
> --
> Kind Regards,
> Daniel Kwiecinski
>
>
>
> ------------------------------
>
>
>
> _______________________________________________
>
> erlang-questions mailing list
> 
>
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
>
>   NOTE: This e-mail message is subject to the MTN Group disclaimer see
> http://www.mtn.co.za/default.aspx?pid=34411
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080131/26509c60/attachment.html>


More information about the erlang-questions mailing list