<div dir="ltr">If you take a look at the implementation in mochiweb_session, you'll see that it's very similar in structure to termit but the IV is generated with random bytes in encrypt_data/2 and there's an eq/2 function to do constant time comparison of signatures.<div>
<br></div><div style>If you're interested in learning more about crypto I highly recommend Dan Boneh's class on Coursera <a href="https://www.coursera.org/course/crypto">https://www.coursera.org/course/crypto</a></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 1, 2013 at 10:58 PM, Vladimir Dronnikov <span dir="ltr"><<a href="mailto:dronnikov@gmail.com" target="_blank">dronnikov@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, Bob!<div>Thank you for feedback. Am not an expert in crypto domain, so I wonder if you could help me amend termit' cryptosystem.<div>
TIA,</div><div>--Vladimir</div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Apr 2, 2013 at 9:50 AM, Bob Ippolito <span dir="ltr"><<a href="mailto:bob@redivi.com" target="_blank">bob@redivi.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">No reason to celebrate just yet, termit has a broken cryptosystem. Here's two things I noticed after a quick glance:<div><br><div>* The IV is derived from the secret key. The IV must be unpredictable at encryption time in CBC mode. This is VERY VERY bad.</div>
<div>* Verification of the signature isn't constant-time, so it's susceptible to timing attacks. This is still bad, but probably harder to exploit.</div></div><div><br></div><div>It would be unwise to use this implementation. I don't claim that the mochiweb code is perfect, and I'm not a cryptograph expert, but I have audited it and I didn't find any obvious flaws (other than the timing attack that I fixed).</div>
</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 1, 2013 at 10:37 PM, Lee Sylvester <span dir="ltr"><<a href="mailto:lee.sylvester@gmail.com" target="_blank">lee.sylvester@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Wow, a fernet like impl for Erlang!!! Perfect!!! Thank you very much. This will make my life so much easier :-)<div>
<br></div><div>Regards,</div><div>Lee</div><div><div><div><br></div><div><br></div><div><br><div><div>On 2 Apr 2013, at 06:09, Vladimir Dronnikov <<a href="mailto:dronnikov@gmail.com" target="_blank">dronnikov@gmail.com</a>> wrote:</div>
<br><blockquote type="cite"><div dir="ltr">I drive <a href="https://github.com/dvv/termit" target="_blank">https://github.com/dvv/termit</a> for this. Feel free to feedback/blame :)</div><div class="gmail_extra"><br><br>
<div class="gmail_quote">
On Tue, Apr 2, 2013 at 12:15 AM, Bob Ippolito <span dir="ltr"><<a href="mailto:bob@redivi.com" target="_blank">bob@redivi.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">There's something similar to your requirements in here:<div><a href="https://github.com/mochi/mochiweb/blob/master/src/mochiweb_session.erl" target="_blank">https://github.com/mochi/mochiweb/blob/master/src/mochiweb_session.erl</a></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div>On Mon, Apr 1, 2013 at 1:05 PM, Lee Sylvester <span dir="ltr"><<a href="mailto:lee.sylvester@gmail.com" target="_blank">lee.sylvester@gmail.com</a>></span> wrote:<br>
</div><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey guys,<br>
<br>
So, I'd like to create secure tokens in Erlang. This can either be a simple UUID generator which I then store with user credentials or a way to encode a string, such as JSON, as an encrypted token. In Golang, I would do this with fernet, but I need an Erlang solution :-)<br>
<br>
I know Erlang isn't best used for such tasks, but does anyone out there know of something usable for this purpose?<br>
<br>
Thanks loads,<br>
Lee<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div></div></div><br></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>