Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I used a reflection tool to look at the bootstrapper generation MSBuild task (on a machine with .NET 4.5 installed) and found that it augments the <code>product.xml</code> file's <code>&lt;PackageFile /&gt;</code> elements. Specifically, it attempts to compute a public key from each file. If it can find one, it compares the key with the value of the <code>PublicKey</code> attribute. If the values are different, it emits a warning but in both cases it keeps the value it just computed.</p> <p>If it couldn't determine a public key, it then computes a SHA256 hash of the file and performs a similar comparison with the value of the <code>Hash</code> attribute, emitting a warning if they are different and setting the value of the <code>Hash</code> attribute with the computed value.</p> <p>You can confirm these findings by extracting the <code>SETUPCFG</code> resource from the resulting <code>setup.exe</code>; it's a text version of a merge of the <code>product.xml</code> files.</p> <p>Anyway, remember how I said it computes a SHA256 hash of the files if it could not find a public key? The documentation for the <a href="http://msdn.microsoft.com/en-us/library/ms229175%28v=vs.100%29.aspx">&lt;PackageFiles&gt; Element (Bootstrapper)</a> says the <strong>value of the <code>Hash</code> attribute should be a SHA1 hash</strong>.</p> <p>I was not able to verify which of SHA1 or SHA256 the resulting <code>setup.exe</code> uses to verify the value of the <code>Hash</code> attribute (it's unmanaged code and I couldn't find the symbols for it), but let the record show that a similar look at the .NET 4.0 version of the bootstrapper generator MSBuild task reveals that it is indeed using the SHA1 algorithm for computing the value of the <code>Hash</code> attribute, so by deduction we can say <code>setup.bin</code> (at least the one from the Windows SDK v7.0A) is using SHA1. I'm pretty sure I tried using the <code>setup.bin</code> from the Windows SDK v8.0A and I got the same (wrong) results. (One could confirm this by copying the <code>setup.bin</code> from the v8.0A SDK to a .NET 4.0-only machine and seeing if the resulting <code>setup.exe</code> can install a custom bootstrapper package using hash-based verification)</p> <p>So, if <strong>hash-based verification is broken in the setup bootstrapper</strong>, we can at least use the public key (certificate-based) verification instead. The good news is that the bootstrapper generator will automatically start using this mechanism if it was able to extract the certificate's public key from the package file. The bad news is that this means <em>each package file must be signed with <code>signtool.exe</code> and a valid code-signing certificate</em> (not everybody might have a code-signing certificate lying around, although if you're doing click-once you might...).</p> <p>Once I signed the package files used by our custom bootstrapper, I stopped getting the installation failures at run-time when I built the project using a machine that had .NET 4.5 installed, while still producing a valid bootstrapper when using a machine that did not have .NET 4.5 installed.</p> <p>tl;dr: Sign your package files with a code-signing certificate to avoid a defect introduced in .NET 4.5.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload