<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> Now I am wondering if I need:<br>
>    - e larger than 3 ? if yes what is the sensible minimum ? I am inclined to set e=11 to get (digest power e) > n but I do not have really clear argument for that. <br>
<br>
Yes. You want something bigger than 3. Three can work, but you have to take care. It's simpler to pick something bigger.<br>
<br>
Mathematically, 5 works just fine. Traditionally in RSA cryptography, 17 and 65537 are traditional because they're (2^n)+1. <br>
<br>
>    - padding the digest before the mod_exp<br>
<br>
Knowing I don't know, why wouldn't you use OAEP or some equivalent?<br></blockquote><div><br></div><div>Thanks for the advices. This is going to a ROM code, this is not general purpose nor updated carelessly by random guys,  so I am willing "to take care" if that saves few bytes in my code and/or improves performance. <br></div><div>I like e=3 very much, with that I could hardcode the main loop to do 2 identical iterations, saving both code size and execution time.<br></div><div>On the padding I don't like OAEP because of the increased complexity which will increase code size. <br></div><div>For now I settled for PKCS1_1v5 following <a href="https://tools.ietf.org/html/rfc8017">https://tools.ietf.org/html/rfc8017</a> (with padding hardcoded for SHA256). Of course I will switch immediatly to OAEP if there is a compelling reason to do that, but my understanding is that PKCS1_1v5 is good enough for my purpose.<br></div><div><br></div><div>So my question can be reformulated as follow: what I would have to ensure to be safe with e=3 and PKCS1_1v5 ?</div><div>- I can take care of not signing the same plaintext with two different keys.</div><div>- I can take care of not signing anything coming from a third party.</div><div>Is there something else to take of ?</div><div><br></div><div>Sebastien<br></div><div><br></div><div><br></div><div> </div></div></div>