[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bouncycastle-crypto-dev
Subject:    Re: [dev-crypto] BcCertTest .pemTest fails with an unhandled exception
From:       David Hook <dgh () autochthonous ! org>
Date:       2013-04-19 6:58:15
Message-ID: 5170EB07.8070509 () autochthonous ! org
[Download RAW message or body]

I haven't seen this myself (yet), but I think the test may need 
tweaking. Looking at it again, I'm not sure if it's actually testing the 
right thing.

Please let us know if anything else shows up.

Thanks,

David

On 17/04/13 01:35, Sunil K. Bhaskarla (AEGIS.net) wrote:
> All,
>
> I get the error below when I run org.bouncycastle.cert.test.AllTests 
> (compiled from the 1.7 compatible source downloaded yesterday)
>
> The OpenJDK 1.7 X509Factory.java's checkHeaderFooter method doesn't 
> seem to handle extraneous headers.
> Has anyone encountered this issue before.
>
> Sunil
>
> In BcCertTest.java:
>
>         cert = readPEMCert(cf, "-----BEGIN CERTIFICATE-----" + 
> PEMData.CERTIFICATE_2);
>         if (cert == null) ////////////When an exception is thrown this 
> code is not reached
>         {
>             fail("PEM cert with extraneous header not read");
>         }
>
>
> My environment is:
> java version "1.7.0_02"
> Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
> Java HotSpot(TM) Client VM (build 22.0-b10, mixed mode, sharing)
>
>
> There was 1 error:
> 1) 
> CertTest(org.bouncycastle.cert.test.BcCertTest)java.security.cert.CertificateException: 
> Could not parse cer
> tificate: java.io.IOException: Header and footer do not match: 
> -----BEGIN CERTIFICATE----------BEGIN CERTIFICA
> TE----- -----END CERTIFICATE-----
>         at 
> sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:104)
>         at 
> java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:339)
>         at 
> org.bouncycastle.cert.test.BcCertTest.readPEMCert(BcCertTest.java:1311)
>         at 
> org.bouncycastle.cert.test.BcCertTest.pemTest(BcCertTest.java:1275)
>         at 
> org.bouncycastle.cert.test.BcCertTest.testCertificates(BcCertTest.java:1442)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at org.bouncycastle.cert.test.AllTests.main(AllTests.java:35)
> Caused by: java.io.IOException: Header and footer do not match: 
> -----BEGIN CERTIFICATE----------BEGIN CERTIFIC
> ATE----- -----END CERTIFICATE-----
>         at 
> sun.security.provider.X509Factory.checkHeaderFooter(X509Factory.java:595)
>         at 
> sun.security.provider.X509Factory.readOneBlock(X509Factory.java:575)
>         at 
> sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:91)
>         ... 22 more
>
> FAILURES!!!
> Tests run: 12,  Failures: 0,  Errors: 1


[Attachment #3 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix"><br>
      I haven't seen this myself (yet), but I think the test may need
      tweaking. Looking at it again, I'm not sure if it's actually
      testing the right thing.<br>
      <br>
      Please let us know if anything else shows up.<br>
      <br>
      Thanks,<br>
      <br>
      David<br>
      <br>
      On 17/04/13 01:35, Sunil K. Bhaskarla (AEGIS.net) wrote:<br>
    </div>
    <blockquote
cite="mid:40333929EBD0074F9AB4F72102444B0F51FD67@AEGIS-EXC-2010.aegis.net"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <style id="owaParaStyle" type="text/css">P \
{margin-top:0;margin-bottom:0;}</style>  <div style="direction: ltr;font-family: \
Tahoma;color:  #000000;font-size: 10pt;">All,<br>
        <br>
        I get the error below when I run
        org.bouncycastle.cert.test.AllTests (compiled from the 1.7
        compatible source downloaded yesterday)<br>
        <br>
        The OpenJDK 1.7 X509Factory.java's <a moz-do-not-send="true"
          name="571">checkHeaderFooter</a> method doesn't seem to handle
        extraneous headers.
        <br>
        Has anyone encountered this issue before.<br>
        <br>
        Sunil<br>
        <br>
        In BcCertTest.java:<br>
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cert = readPEMCert(cf, "-----BEGIN \
CERTIFICATE-----" +  PEMData.CERTIFICATE_2);<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (cert == null) ////////////When \
an exception is  thrown this code is not reached<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fail("PEM \
cert with extraneous header not read");<br>  \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>  <br>
        <br>
        My environment is:<br>
        java version "1.7.0_02"<br>
        Java(TM) SE Runtime Environment (build 1.7.0_02-b13)<br>
        Java HotSpot(TM) Client VM (build 22.0-b10, mixed mode, sharing)<br>
        <br>
        <br>
        There was 1 error:<br>
        1)
        CertTest(org.bouncycastle.cert.test.BcCertTest)java.security.cert.CertificateException:
  Could not parse cer<br>
        tificate: java.io.IOException: Header and footer do not match:
        -----BEGIN CERTIFICATE----------BEGIN CERTIFICA<br>
        TE----- -----END CERTIFICATE-----<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:104)<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:339)<br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
        org.bouncycastle.cert.test.BcCertTest.readPEMCert(BcCertTest.java:1311)<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
        org.bouncycastle.cert.test.BcCertTest.pemTest(BcCertTest.java:1275)<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
org.bouncycastle.cert.test.BcCertTest.testCertificates(BcCertTest.java:1442)<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at \
sun.reflect.NativeMethodAccessorImpl.invoke0(Native  Method)<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
        org.bouncycastle.cert.test.AllTests.main(AllTests.java:35)<br>
        Caused by: java.io.IOException: Header and footer do not match:
        -----BEGIN CERTIFICATE----------BEGIN CERTIFIC<br>
        ATE----- -----END CERTIFICATE-----<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
sun.security.provider.X509Factory.checkHeaderFooter(X509Factory.java:595)<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
        sun.security.provider.X509Factory.readOneBlock(X509Factory.java:575)<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:91)<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ... 22 more<br>
        <br>
        FAILURES!!!<br>
        Tests run: 12,&nbsp; Failures: 0,&nbsp; Errors: 1<br>
      </div>
    </blockquote>
    <br>
  </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic