Re: Problems with certificates form HTTPS connections

Volker Berlin <[email protected]> Tue, 7 Feb 2017 16:08:27 +0100
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <[email protected]>
--===============0807367638478190187==
Content-Type: multipart/alternative;
	boundary="------------D372014D8B148CA6A9976E92"

--------------D372014D8B148CA6A9976E92
Content-Type: text/plain; charset="windows-1252"
Content-Transfer-Encoding: 8bit

Hi Jeroen,

Thanks, this help to solve it. With powershell we call the follow line
before run it and it work.
[System.Net.WebRequest]::Create("https://inetsoftware.de").GetResponse().Close()

Volker


Am 07.02.2017 um 13:42 schrieb Jeroen Frijters:
>
> Hi Volker,
>
>  
>
> The trusted root certificates are read from the system via the .NET
> class X509Store (the code is in vfs.cs).
>
>  
>
> The problem with this approach is that Windows downloads the trusted
> root certificates on-demand and so the content of this store depends
> on what websites the user has visited. I didn’t know this when I
> designed this mechanism, but I also don’t want to be in the business
> of distributing trusted root certificates, so I don’t really know how
> to solve this.
>
>  
>
> Regards,
>
> Jeroen
>
>  
>
> *From:*Volker Berlin [mailto:[email protected]]
> *Sent:* Tuesday, February 7, 2017 11:56
> *To:* IKVM List <[email protected]>
> *Subject:* [Ikvm-developers] Problems with certificates form HTTPS
> connections
>
>  
>
> Hi Jeroen,
>
> We have problems with HTTPS connections from a docker installation.
> The certificate can't validate. For validating the Java VM use the
> root certificates saved in <java.home>\lib\security\cacerts. In IKVM
> this is a virtual file. We receive different files if we read it
> directly inside IKVM on different systems.
>
> That the core Questions:
>
> * From where read IKVM the cacerts file?
> * Any idea how we can fix this?
>
> Volker
>
>
> How we have read the file:
>
> File cert = new File(java.lang.System.getProperty("java.home") +
> File.separator + "lib" + File.separator + "security" + File.separator
> + "cacerts");
>
> FileInputStream input = new FileInputStream(cert);
>
> FileOutputStream output = new
> FileOutputStream("c:\\temp\\cert_export.txt");
>
> int data = input.read();
>
> while(data != -1)
>
> {
>
>    output.write(data);
>
>    data = input.read();
>
> }
>
> input.close();
>
> output.close();
>
>  
>
>  
>


--------------D372014D8B148CA6A9976E92
Content-Type: text/html; charset="windows-1252"
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi Jeroen,</p>
    <p>Thanks, this help to solve it. With powershell we call the follow
      line before run it and it work.
[System.Net.WebRequest]::Create(<a class="moz-txt-link-rfc2396E" href="https://inetsoftware.de">"https://inetsoftware.de"</a>).GetResponse().Close()<br>
    </p>
    <p>Volker<br>
    </p>
    <br>
    <div class="moz-cite-prefix">Am 07.02.2017 um 13:42 schrieb Jeroen
      Frijters:<br>
    </div>
    <blockquote
cite="mid:AM2PR08MB0051BE713451FAD51AB23747A2430@AM2PR08MB0051.eurprd08.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;
	color:black;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
	{mso-style-name:msonormal;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;
	color:black;}
span.EmailStyle19
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
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:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:windowtext">Hi
            Volker,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:windowtext"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:windowtext">The
            trusted root certificates are read from the system via the
            .NET class X509Store (the code is in vfs.cs).<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:windowtext"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:windowtext">The
            problem with this approach is that Windows downloads the
            trusted root certificates on-demand and so the content of
            this store depends on what websites the user has visited. I
            didn’t know this when I designed this mechanism, but I also
            don’t want to be in the business of distributing trusted
            root certificates, so I don’t really know how to solve this.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:windowtext"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:windowtext">Regards,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:windowtext">Jeroen<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:windowtext"><o:p> </o:p></span></p>
        <div style="border:none;border-left:solid blue 1.5pt;padding:0in
          0in 0in 4.0pt">
          <div>
            <div style="border:none;border-top:solid #E1E1E1
              1.0pt;padding:3.0pt 0in 0in 0in">
              <p class="MsoNormal"><b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:windowtext">From:</span></b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:windowtext">
                  Volker Berlin [<a class="moz-txt-link-freetext" href="mailto:[email protected]">mailto:[email protected]</a>]
                  <br>
                  <b>Sent:</b> Tuesday, February 7, 2017 11:56<br>
                  <b>To:</b> IKVM List
                  <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a><br>
                  <b>Subject:</b> [Ikvm-developers] Problems with
                  certificates form HTTPS connections<o:p></o:p></span></p>
            </div>
          </div>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p>Hi Jeroen,<o:p></o:p></p>
          <p>We have problems with HTTPS connections from a docker
            installation. The certificate can't validate. For validating
            the Java VM use the root certificates saved in
            &lt;java.home&gt;\lib\security\cacerts. In IKVM this is a
            virtual file. We receive different files if we read it
            directly inside IKVM on different systems.<o:p></o:p></p>
          <div>
            <p class="MsoNormal">That the core Questions: <br>
              <br>
              * From where read IKVM the cacerts file?<br>
              * Any idea how we can fix this?<br>
              <br>
              Volker<br>
              <br>
              <br>
              How we have read the file: <br>
              <br>
              <o:p></o:p></p>
            <div>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">File
                cert = new
                File(java.lang.System.getProperty("java.home") +
                File.separator + "lib" + File.separator + "security" +
                File.separator + "cacerts");<o:p></o:p></p>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">FileInputStream
                input = new FileInputStream(cert);<o:p></o:p></p>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">FileOutputStream
                output = new
                FileOutputStream("c:\\temp\\cert_export.txt");<o:p></o:p></p>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">int
                data = input.read();<o:p></o:p></p>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">while(data
                != -1)<o:p></o:p></p>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">{<o:p></o:p></p>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">  
                output.write(data);<o:p></o:p></p>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">  
                data = input.read();<o:p></o:p></p>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">}<o:p></o:p></p>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">input.close();<o:p></o:p></p>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">output.close();<o:p></o:p></p>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
              <p class="MsoNormal"
                style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>

--------------D372014D8B148CA6A9976E92--


--===============0807367638478190187==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--===============0807367638478190187==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ikvm-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

--===============0807367638478190187==--