<div class="gmail_quote">On Mon, Apr 25, 2011 at 9:40 PM, Peter W. Morreale <span dir="ltr"><<a href="mailto:pmorreale@novell.com">pmorreale@novell.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
<br>
Does anyone have some example code showing usage of public_key:sign and public_key:verify()? <br>
<br>
I'm having a very difficult time getting the following to work:
<pre> Cert2 = "-----BEGIN CERTIFICATE-----\nMIIB8TCCAVqgAwIBAgIFAIxwZnIwDQYJKoZIhvcNAQEEBQAwLjELMAkGA1UEBhMCREUxEjAQBgNVBAoTCVNTT0NpcmNsZTELMAkGA1UEAxMCQ0EwHhcNMDkwMjIyMTUwNDI0WhcNMTEwNTIyMTUwNDI0WjBLMQswCQYDVQQGEwJERTESMBAGA1UEChMJU1NPQ2lyY2xlMQwwCgYDVQQLEwNpZHAxGjAYBgNVBAMTEWlkcC5zc29jaXJjbGUuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCbzDRkudC/aC2gMqRVVaLdPJJEwpFB4o71fR5bnNd2ocnnNzJ/W9CoCargzKx+EJ4Nm3vWmX/IZRCFvrvy9C78fP1cmt6Sa091K9luaMAyWn7oC8h/YBXH7rB42tdvWLY4Kl9VJy6UCclvasyrfKx+SR4KU6zCsM622Kvp5wW67QIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAGyaydfJHDkm77C39gq9bBb7OqK8OXEUTbIMp8PDJZzIf9QkpkE7gHGcWctRKi7fNdONulc5kn2K2nbvCGrbWsWQvr/DA0bjkBrK8OeWpRhLe7fl+JUgsErMcDIzRTmjNpZzUZp+WESRHV1j3SIcfY4tJM2uMt4Sc/afVnl5P6wL\n-----END CERTIFICATE-----",
Text = "some text",
Pb = list_to_binary(Cert2),
PemEntries = public_key:pem_decode(Pb),
RSAPubKey = public_key:pem_entry_decode(hd(PemEntries)),
Msg = list_to_binary(Text),
C = public_key:sign(Msg, sha, RSAPubKey),
io:fwrite("sign: ~p~n", [C]),
</pre>
<br>
<br>
I'm generating "escript: exception error: function_clause".<br></div></blockquote><div><br>No first hand experience but since I'd like to do something like this shortly, looked around and found this thread:<br>
<a href="http://erlang.org/pipermail/erlang-questions/2011-January/055880.html">http://erlang.org/pipermail/erlang-questions/2011-January/055880.html</a><br>Does that help ? <br></div></div>