Re: Encoding Bug in ASN1Set
David Hook <dgh-rTAZ0PM/[email protected]> Fri, 13 Dec 2019 22:21:08 +1100
| Newsgroups | gmane.comp.encryption.bouncy-castle.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --------------234193084E5A0FE426D76CD6 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit DER encoding requires sets to be sorted. You could almost say it's the whole point - the idea is that there should be only way to compute a signature over the data. Signatures that rely on unsorted sets to validate are invalid. Regards, David On 13/12/19 9:20 pm, MSKnete-S0/[email protected] wrote: > Hi, > > I have notice a bug in org.bouncycastle.asn1.ASN1Set.toDERObject() > that could lead to reporting valid signatures as invalid. ASN1Sets can > apparently be sorted or not. However why the mentioned method does > sort unsorted sets and dosn't sort sorted ones is a mystery to me. Can > you please switch the cases to fix the bug? > > Regards, > Michael --------------234193084E5A0FE426D76CD6 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body text="#000000" bgcolor="#FFFFFF"> <div class="moz-cite-prefix"><br> </div> <div class="moz-cite-prefix">DER encoding requires sets to be sorted. You could almost say it's the whole point - the idea is that there should be only way to compute a signature over the data. Signatures that rely on unsorted sets to validate are invalid.<br> </div> <div class="moz-cite-prefix"><br> </div> <div class="moz-cite-prefix">Regards,</div> <div class="moz-cite-prefix"><br> </div> <div class="moz-cite-prefix">David<br> </div> <div class="moz-cite-prefix">On 13/12/19 9:20 pm, <a class="moz-txt-link-abbreviated" href="mailto:MSKnete-S0/[email protected]">MSKnete-S0/[email protected]</a> wrote:<br> </div> <blockquote type="cite" cite="mid:trinity-a3675d1c-6c33-479d-8826-a8bf86654296-1576232446630@3c-app-webde-bs14"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <div style="font-family: Verdana;font-size: 12.0px;"> <div> <div>Hi,</div> <div> </div> <div>I have notice a bug in <span style="font-family:Courier New,Courier,monospace;">org.bouncycastle.asn1.ASN1Set.toDERObject()</span> that could lead to reporting valid signatures as invalid. ASN1Sets can apparently be sorted or not. However why the mentioned method does sort unsorted sets and dosn't sort sorted ones is a mystery to me. Can you please switch the cases to fix the bug?</div> <div> </div> <div>Regards,<br> Michael</div> </div> </div> </blockquote> <p><br> </p> </body> </html> --------------234193084E5A0FE426D76CD6--