<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jozef Izso</title>
    <description>The latest articles on Forem by Jozef Izso (@jozefizso).</description>
    <link>https://forem.com/jozefizso</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F6480%2F2qou-8k2.jpg</url>
      <title>Forem: Jozef Izso</title>
      <link>https://forem.com/jozefizso</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jozefizso"/>
    <language>en</language>
    <item>
      <title>Run InspectCode in your GitHub Actions</title>
      <dc:creator>Jozef Izso</dc:creator>
      <pubDate>Sat, 25 Apr 2020 18:49:10 +0000</pubDate>
      <link>https://forem.com/jozefizso/run-inspectcode-in-your-github-actions-3gg6</link>
      <guid>https://forem.com/jozefizso/run-inspectcode-in-your-github-actions-3gg6</guid>
      <description>&lt;p&gt;When you build .NET projects and you are using GitHub Actions to build your code, you cna now run code inspections with &lt;strong&gt;InspectCode&lt;/strong&gt; without hassle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;InspectCode&lt;/strong&gt; is a tool from the free &lt;strong&gt;ReSharper Command Line Tools&lt;/strong&gt; (CTL). It can do solution-wide analysis of .NET code.&lt;/p&gt;

&lt;p&gt;To use it in GitHub Actions, just add this code to your workflow file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;goit/setup-resharper@v1&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;2020.1'&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;InspectCode SolutionFile.sln&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;goit/setup-resharper&lt;/strong&gt; action will download the ReSharper CTL and cache it locally (using the &lt;strong&gt;actions/tool-cache&lt;/strong&gt;). ReSharper tools will be added to the %PATH% variable so you can use them anywhere in your build scripts.&lt;/p&gt;

&lt;p&gt;As ReSharper CTL tools are supported on Windows, Linux and macOS (versions 2019.3 and newer) you can use the also for non-Windows builds. The setup action supports any ReSharper CTL newer then 2018.2.&lt;/p&gt;

&lt;p&gt;Go to &lt;a href="https://github.com/marketplace/actions/setup-resharper-command-line-tools"&gt;GitHub Marketplace&lt;/a&gt; to use this action, or checkout the source code at &lt;a href="https://github.com/goit/setup-resharper"&gt;https://github.com/goit/setup-resharper&lt;/a&gt;&lt;/p&gt;

</description>
      <category>githubactions</category>
      <category>resharper</category>
      <category>codequality</category>
      <category>devops</category>
    </item>
    <item>
      <title>.gitattributes templates</title>
      <dc:creator>Jozef Izso</dc:creator>
      <pubDate>Sat, 26 May 2018 10:01:10 +0000</pubDate>
      <link>https://forem.com/jozefizso/gitattributes-templates-246a</link>
      <guid>https://forem.com/jozefizso/gitattributes-templates-246a</guid>
      <description>&lt;p&gt;&lt;a href="https://gitattributes.io"&gt;gitattributes.io&lt;/a&gt; is a service for generating &lt;code&gt;.gitattribute&lt;/code&gt; files from templates. The service is inspired by &lt;a href="https://www.gitignore.io"&gt;gitignore.io&lt;/a&gt; where you can quickly bootstrap your &lt;code&gt;.gitignore&lt;/code&gt; files.&lt;/p&gt;

&lt;p&gt;Choose templates on web interface, or use the very simple API to list template names and generate new &lt;code&gt;.gitattribute&lt;/code&gt; file content.&lt;/p&gt;

&lt;p&gt;To generate &lt;code&gt;.gitattributes&lt;/code&gt; file for you web project, just call:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://gitattributes.io/api/web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Working on a C++ project in Visual Studio? Separate multiple template names with a comma:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://gitattributes.io/api/c++,visualstudio
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The list of all template names is available at &lt;code&gt;api/list&lt;/code&gt; endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://gitattributes.io/api/list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This service was made possible by the project from &lt;strong&gt;alexkaratarakis&lt;/strong&gt; who created the original &lt;a href="https://github.com/alexkaratarakis/gitattributes"&gt;alexkaratarakis/gitattributes&lt;/a&gt; repository with &lt;code&gt;.gitattributes&lt;/code&gt; templates. You can contribute to &lt;strong&gt;gitattributes.io&lt;/strong&gt; project at &lt;a href="https://github.com/gitattributes"&gt;github.com/gitattributes&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>showdev</category>
      <category>gitignore</category>
      <category>gitattributes</category>
    </item>
    <item>
      <title>Digital Signatures in Open Source Projects</title>
      <dc:creator>Jozef Izso</dc:creator>
      <pubDate>Fri, 25 May 2018 20:47:26 +0000</pubDate>
      <link>https://forem.com/jozefizso/digital-signatures-in-open-source-projects-17f5</link>
      <guid>https://forem.com/jozefizso/digital-signatures-in-open-source-projects-17f5</guid>
      <description>&lt;p&gt;&lt;em&gt;Originaly posted at &lt;a href="https://izsak.net/weblog/860/digital-signatures-for-binaries-in-open-source-projects/"&gt;Digital signatures for binaries in open source projects&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Digital signatures provides proof that the file was authored by a trusted entity. They allow to verify the integrity of applications distributed in binary form. On Windows, software authors use Authenticode to sign the application and its setup package so Windows can verify who made the application and it allows IT adminstrators to create policies for running only trusted applications.&lt;/p&gt;

&lt;p&gt;Open source applications (for Windows) usually are not signed because the Authenticode certificates are expensive and the learning curve for signing is quite steap.&lt;/p&gt;

&lt;p&gt;I chose Certum to get certificate for my open source applications. The Authenticode certificate from Certum costs only around 28 EUR. If you does not have any compatible smart card which would store the certificate private key, you can buy one from Certum, but this makes the certificate a bit expensive (for hobby purposes) - the smart card costs 80 EUR and shipping is 30 EUR.&lt;/p&gt;

&lt;p&gt;Ordering the certificate from Certum was a bit complicated and painful process as their website likes to switch to Polish language out of a sudden.  Authenticode certificates must be issued to natural persons (or legal entities) so the process is not automated (as with Let's Encrypt domain validation) and you must provide them your ID card and some utility bills or bank statement to verify you identity.&lt;/p&gt;

&lt;p&gt;Out of the box, you can use the certificate to sign applications (EXE, DLL and MSI files) with &lt;strong&gt;signtool.exe&lt;/strong&gt; using the default SHA1 algorithms. You must run the &lt;strong&gt;proCertum CardManager&lt;/strong&gt; application so &lt;strong&gt;signtool.exe&lt;/strong&gt; can communicate with the smart card when signing binaries. Each time you are signing a file, &lt;strong&gt;CardManager&lt;/strong&gt; will ask for a PIN to the certificate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sign application
&lt;/h2&gt;

&lt;p&gt;To sign application named &lt;code&gt;VCardSplitter.exe&lt;/code&gt; using certificate named &lt;code&gt;Open Source Developer, Jozef Izso&lt;/code&gt;, use this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;signtool.exe sign /n "Open Source Developer, Jozef Izso" VCardSplitter.exe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will just sign the file. You must also add the timestamp to the signature so the signature will remain valid even after certificate expires.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;signtool.exe sign /n "Open Source Developer, Jozef Izso" /fd sha1 /t http://timestamp.verisign.com/scripts/timstamp.dll VCardSplitter.exe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Signing using SHA256 algorithm
&lt;/h2&gt;

&lt;p&gt;Microsoft requires new applications to be signed using SHA256 algorithm. When you configure &lt;strong&gt;signtool.exe&lt;/strong&gt; to use SHA256, you will receive error when signing files. To resolve this issue, open &lt;strong&gt;proCertum CardManager&lt;/strong&gt;, click &lt;strong&gt;Options&lt;/strong&gt;, enable &lt;strong&gt;EV Code Signing - replace CSP with minidriver library&lt;/strong&gt; and click &lt;strong&gt;Ok&lt;/strong&gt;. This will reconfigure the system and the SHA256 algorithms will work correctly. &lt;strong&gt;Note:&lt;/strong&gt; the certificate for open source developers from Certum is not the &lt;em&gt;EV (Extended Validation) certificate&lt;/em&gt;. It just hapens the CSP method of signing with smart card is only compatible with the old SHA1 signatures.&lt;/p&gt;

&lt;p&gt;With minidriver mode enable, you can sign your binaries like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;signtool.exe sign /n "Open Source Developer, Jozef Izso" /fd sha256 /tr http://timestamp.comodoca.com VCardSplitter.exe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Signing NuGet packages
&lt;/h2&gt;

&lt;p&gt;NuGet 4.6 enables signing of nuget packages. It requires the signature to be SHA256 so make sure you enabled the &lt;strong&gt;minidriver&lt;/strong&gt; mode.&lt;br&gt;
Signing is similar to the &lt;strong&gt;signtool.exe&lt;/strong&gt; process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nuget.exe sign library.1.0.0.nupkg -CertificateSubjectName "Open Source Developer, Jozef Izso" -Timestamper http://timestamp.comodoca.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Switching the CSP and minidrive mode in proCertum CardManager
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;proCertum CardManager&lt;/strong&gt; uses special app called &lt;code&gt;cryptoCardRegister.exe&lt;/code&gt; to switch between the &lt;strong&gt;CSP&lt;/strong&gt; and &lt;strong&gt;minidriver&lt;/strong&gt; modes of signing.&lt;br&gt;
This can be change from the &lt;strong&gt;proCertum CardManager&lt;/strong&gt; user interface:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;proCertum CardManager&lt;/strong&gt; application&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Options&lt;/strong&gt; button&lt;/li&gt;
&lt;li&gt;Enable or disable the &lt;strong&gt;EV Code Signing - replace CSP with minidriver library&lt;/strong&gt; checkbox&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Ok&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you have troubles with using the UI to change the mode, you can execute &lt;code&gt;cryptoCardRegister.exe&lt;/code&gt; directly from command prompt.&lt;/p&gt;

&lt;p&gt;To enable &lt;strong&gt;CSP&lt;/strong&gt; mode manually, use administrative prompt to run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"C:\Program Files (x86)\Certum\proCertum CardManager\cryptoCardRegister.exe" csp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To enable &lt;strong&gt;minidriver&lt;/strong&gt; mode manually, use administrative prompt to run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"C:\Program Files (x86)\Certum\proCertum CardManager\cryptoCardRegister.exe" md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Digital signatures can ensure your Windows binaries can be verified to come from trusted source. As open source developer, you must invest about 100-150 EUR to get the first certificate. The certificate from Certum will be issued to you as a natural person and it will be named &lt;strong&gt;Open Source Developer, &lt;/strong&gt;. After correctly changing the &lt;strong&gt;CardManager&lt;/strong&gt; configuration, you can sign you Windows applications, libraries, installation packages and also nuget packages. Signing cannot be automated as you must enter the PIN each time you sign a file. This prohibits scenarios like automatic signing of build output on continous integrations services like AppVeyor.&lt;/p&gt;

&lt;p&gt;I hope code signing certificates will get more available to open source developers and projects and cloud services could be used to automate signing as part of the build process. This would make the ecosystem of open source libraries for Windows more trusted.&lt;/p&gt;

</description>
      <category>windows</category>
      <category>development</category>
      <category>digitalsignatures</category>
      <category>authenticode</category>
    </item>
  </channel>
</rss>
