Re: Bc error validating signature with ECC cert
David Hook <dgh-rTAZ0PM/[email protected]> Fri, 13 Dec 2019 22:26:05 +1100
| Newsgroups | gmane.comp.encryption.bouncy-castle.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--------------C76401ABAB2DB77400ACDA33
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 8bit
Are you sure the BC provider is being used here? I would have expected
new JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(certHolder)
If that was the case.
Regards,
David
On 13/12/19 10:13 pm, Emiliano Latini wrote:
>
> Hi all,
>
>
>
> Im checking a signature with BC, ti worked for months but Ive came
> across this excetion checking a signed a file:
>
>
>
> java.io.IOException: Unknown named curve: 1.3.36.3.3.2.8.1.1.7
>
>
>
> A brief search resulted in problems with ECC certificates such as
> brainpool.
>
>
>
> Any Ideas?
>
>
>
> Below a snippet of code:
>
>
>
> ASN1InputStream aIn = new ASN1InputStream(signedData);
>
> CMSSignedData s = new
> CMSSignedData(ContentInfo.getInstance(aIn.readObject()));
>
>
>
> aIn.close();
>
>
>
> Store certs = s.getCertificates();
>
> SignerInformationStore signers = s.getSignerInfos();
>
> Collection<SignerInformation> c = signers.getSigners();
>
>
>
> List<Boolean> isValidSigner = new ArrayList<Boolean>();
>
> CertificateHelper x509CertHelper= new CertificateHelper();
>
> for(SignerInformation signer:c){
>
>
>
> Collection<X509CertificateHolder> certCollection =
> certs.getMatches(signer.getSID());
>
> Iterator<X509CertificateHolder> certIt =
> certCollection.iterator();
>
> X509CertificateHolder certHolder = certIt.next();
>
> boolean verifResult = signer.verify(new
> JcaSimpleSignerInfoVerifierBuilder().build(certHolder));
>
>
>
>
>
>
>
>
>
> The exception arises in:signer.verify(new
> JcaSimpleSignerInfoVerifierBuilder().build(certHolder));
>
>
>
>
>
--------------C76401ABAB2DB77400ACDA33
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: 8bit
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Are you sure the BC provider is being
used here? I would have expected<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">new
JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(certHolder)</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">If that was the case.</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</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 13/12/19 10:13 pm, Emiliano Latini
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:PR1PR01MB4795C1AECE4C5257C0E0280098540-RV51X3Ztkg05m3H0FNGn90kjWqoxvGUhiWZaQy0nMoadU/p4gVGmPFaTQe2KTcn/@public.gmane.org">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.StileMessaggioDiPostaElettronica17
{mso-style-type:personal-compose;
font-family:"Tahoma","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 2.0cm 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Hi
all,<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Im
checking a signature with BC, ti worked for months but Ive
came across this excetion checking a signed a file:<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">java.io.IOException:
Unknown named curve: 1.3.36.3.3.2.8.1.1.7<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">A
brief search resulted in problems with ECC certificates such
as brainpool.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Any
Ideas?<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Below
a snippet of code:<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"
style="margin-left:35.4pt;text-indent:35.4pt;text-autospace:none">
<span style="font-size:10.0pt;font-family:"Courier
New"">ASN1InputStream aIn = new
ASN1InputStream(signedData);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
CMSSignedData s = new
CMSSignedData(ContentInfo.getInstance(aIn.readObject()));<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
aIn.close();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
Store certs = s.getCertificates();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
SignerInformationStore signers = s.getSignerInfos();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
Collection<SignerInformation> c =
signers.getSigners();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
List<Boolean> isValidSigner = new
ArrayList<Boolean>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
CertificateHelper x509CertHelper= new CertificateHelper();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
for(SignerInformation signer:c){<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
Collection<X509CertificateHolder> certCollection =
certs.getMatches(signer.getSID());<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
Iterator<X509CertificateHolder> certIt =
certCollection.iterator();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Courier New"">
X509CertificateHolder certHolder = certIt.next();<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
boolean verifResult = signer.verify(new
JcaSimpleSignerInfoVerifierBuilder().build(certHolder))</span><span
style="font-size:10.0pt;font-family:"Courier
New";color:lavender">;<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:lavender"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas;color:lavender"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas;color:lavender">
<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:lavender"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">The
exception arises in:</span><span
style="font-size:10.0pt;font-family:"Courier New"">
signer.verify(new
JcaSimpleSignerInfoVerifierBuilder().build(certHolder));<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas;color:lavender"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote>
<p><br>
</p>
</body>
</html>
--------------C76401ABAB2DB77400ACDA33--