{"id":3567,"date":"2023-12-02T07:24:18","date_gmt":"2023-12-02T06:24:18","guid":{"rendered":"https:\/\/kudzia.eu\/b\/?p=3567"},"modified":"2023-12-26T17:30:44","modified_gmt":"2023-12-26T16:30:44","slug":"getting-code-signing-certificate-on-own-yubikey-and-then-using-it-to-sign-windows-binaries-in-unattended-way-on-kvm-vm","status":"publish","type":"post","link":"https:\/\/kudzia.eu\/b\/2023\/12\/getting-code-signing-certificate-on-own-yubikey-and-then-using-it-to-sign-windows-binaries-in-unattended-way-on-kvm-vm\/","title":{"rendered":"getting code signing certificate on own Yubikey and then using it to sign windows binaries in unattended way, on KVM VM"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>starting from June 2023 code signing certificates for MS Windows cannot be delivered as a file anymore. files are easy to steal. now certs must reside on security modules which don&#8217;t allow private key extraction, at least not for mere mortals.<\/p>\n\n\n\n<p>we&#8217;re using such a cert to sign exe and msi files on a build server which is a VM running Server version of MS Windows. below &#8211; details how to get a new cert and make it work in such CI\/CD environment.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>i&#8217;ve done some googling and found few resouces:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/news.ycombinator.com\/item?id=38055816\" rel=\"noreferrer noopener\" target=\"_blank\">HN: The Windows installer of ImageMagick will no longer be signed<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/clarionhub.com\/t\/notes-on-signing-code-with-your-own-hardware-yubikey\/6655\" rel=\"noreferrer noopener\" target=\"_blank\">Notes on signing code with your own hardware (Yubikey)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.finalbuilder.com\/resources\/blogs\/code-signing-with-usb-tokens\" rel=\"noreferrer noopener\" target=\"_blank\">Code Signing with USB Tokens<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/melatonin.dev\/blog\/how-to-code-sign-windows-installers-with-an-ev-cert-on-github-actions\/\" rel=\"noreferrer noopener\" target=\"_blank\">How to code sign Windows installers with an EV cert on GitHub Actions<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/forum.xojo.com\/t\/windows-ev-code-signing-without-hardware-token\/77231\/4\" rel=\"noreferrer noopener\" target=\"_blank\">another discussion<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.reddit.com\/r\/yubikey\/comments\/15n82s6\/how_to_sign_windows_executable_with_yubikey_and\/\" rel=\"noreferrer noopener\" target=\"_blank\">code signing with yubikey on windows<\/a> [ no mention of automatization ]<\/li>\n\n\n\n<li><a href=\"https:\/\/stackoverflow.com\/a\/77200108\/104398\" rel=\"noreferrer noopener\" target=\"_blank\">automating EV code signing with yubikey<\/a><\/li>\n<\/ul>\n\n\n\n<p>looks like cloud-based signing is &#8216;the easy way&#8217;, but we wanted to avoid it for multiple reasons, including security and costs. few of the offers:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/store.entrust.com\/default\/ov-ev-code-signing-as-a-service.html\" rel=\"noreferrer noopener\" target=\"_blank\">https:\/\/store.entrust.com\/default\/ov-ev-code-signing-as-a-se&#8230;<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.digicert.com\/content\/dam\/digicert\/pdfs\/datasheet\/digicert-keylocker-datasheet-en.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.digicert.com\/content\/dam\/digicert\/pdfs\/datasheet&#8230;<\/a><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">purchases<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>i&#8217;ve bought Organization Validation Code signing certificate from <a href=\"https:\/\/ssl.com\">ssl.com<\/a>. website is sketchy, i even got errors in the process but their support was responsive and i got vetted [ i have proven that i am acting on behalf of the company for which i&#8217;ve ordered the cert ] within few days:\n<ul class=\"wp-block-list\">\n<li>i had to provide registration papers, <\/li>\n\n\n\n<li>i also gave DUNS number to speed things up,<\/li>\n\n\n\n<li>they made automated call to number visible in D&amp;B records, i had to re-type the number provided over the phone to their website,<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>separately &#8211; i&#8217;ve bought Yubikey 5 Nano FIPS &#8211; to be sure that i&#8217;m generating the private key and it&#8217;s not known to anyone else.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">finalizing the cert issuance<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>based on <a href=\"https:\/\/www.ssl.com\/how-to\/key-generation-and-attestation-with-yubikey\">https:\/\/www.ssl.com\/how-to\/key-generation-and-attestation-with-yubikey<\/a>\/ i&#8217;ve generated private key on the newly bought Yubikey 5 Nano FIPS:\n<ul class=\"wp-block-list\">\n<li>in the process i&#8217;ve set my own PIN, PUK and Management key for Yubikey via Yubikey Manager,<\/li>\n\n\n\n<li>in Yubikey Manager i&#8217;ve generated code signing certificate in slot 9a, with ECC P384 private key, then &#8211; following instruction above &#8211; i&#8217;ve created attestation file [ proving that private key was created on Yubikey device ] and intermediate certificate,<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>I&#8217;ve provided both of above to ssl.com and waited for them to issue the certificate,<\/li>\n\n\n\n<li>once i got the certificate &#8211; i&#8217;ve imported it together with intermediate and root cert of ssl.com to yubikey [ based on <a href=\"https:\/\/www.ssl.com\/how-to\/install-sslcom-root-and-intermediate-certificates-on-yubikey\/\">https:\/\/www.ssl.com\/how-to\/install-sslcom-root-and-intermediate-certificates-on-yubikey\/<\/a> ],<\/li>\n\n\n\n<li>i&#8217;ve installed yubikey&#8217;s <a href=\"https:\/\/www.yubico.com\/support\/download\/smart-card-drivers-tools\/\">smartcard minidriver<\/a> and rebooted my pc,<\/li>\n\n\n\n<li>after that the new certificate showed up in certmgr.msc &gt; personal &gt; certificates &#8211; good!<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">testing if the certificate works<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>i&#8217;ve installed signtool from <a href=\"https:\/\/developer.microsoft.com\/en-us\/windows\/downloads\/windows-sdk\/\">https:\/\/developer.microsoft.com\/en-us\/windows\/downloads\/windows-sdk\/<\/a><\/li>\n\n\n\n<li>i was able to successful sign an exe with <em><em>signtool.exe sign \/sha1 2ad5caaad3caf23baa33a2ad7a6eaaf18255a7c7 \/fd sha256 \/td sha256 \/tr <\/em><\/em><a href=\"http:\/\/timestamp.digicert.com\/\" target=\"_blank\" rel=\"noreferrer noopener\"><em>http:\/\/timestamp.digicert.com<\/em><\/a><em><em> &#8220;Clear Settings Wizard.exe&#8221;<\/em><\/em> where the long hex string is a thumbprint of my new certificate, it can be found in certmgr.msc &gt; personal &gt; certificates. <\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">setting up VM with Windows Server<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>qemu-img create -f qcow2 vda.qcow2 32G\nvirt-install --connect qemu:\/\/\/system --arch=x86_64 -n w2 -r 6144 --vcpus=4 --cdrom ..\/win2022\/SERVER_EVAL_x64FRE_en-us.iso --disk path=vda.qcow2 --disk path=..\/win2022\/virtio-win.iso,device=cdrom --graphics vnc,listen=127.0.0.1,port=5907 --noautoconsole --os-type windows --os-variant=win2k16 --network=bridge:br0,model=virtio --accelerate --noapic\n\n# windows iso taken from https:\/\/www.microsoft.com\/en-us\/evalcenter\/download-windows-server-2022\n# virtio-win drivers taken from the latest build at https:\/\/fedorapeople.org\/groups\/virt\/virtio-win\/direct-downloads\/archive-virtio\/<\/code><\/pre>\n\n\n\n<p>i&#8217;ve continued the setup via VNC available on loopback of my linux box, on port 5907<\/p>\n\n\n\n<p>once system was installed &#8211; i&#8217;ve:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>installed virtio drivers from the ISO file &#8211; by running virtio-win-gt-x64.msifrom it<\/li>\n\n\n\n<li>run windows updates and rebooted the Windows Server VM few times<\/li>\n\n\n\n<li>enabled RDP access<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">passing USB device from physical server to Windows VM<\/h2>\n\n\n\n<p>i&#8217;m working with assumption that only one yubikey will be plugged into physical server &#8211; so it&#8217;s enough find out identifier of the USB token that i want to pass to Windows VM:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lsusb -v|less\n# i'm searching for Yubico\nBus 001 Device 002: ID 1050:0404 Yubico.com Yubikey 4\/5 CCID\nDevice Descriptor:\n  bLength                18\n  bDescriptorType         1\n  bcdUSB               2.00\n  bDeviceClass            0\n  bDeviceSubClass         0\n  bDeviceProtocol         0\n  bMaxPacketSize0        64\n  idVendor           0x1050 Yubico.com\n  idProduct          0x0404 Yubikey 4\/5 CCID\n  bcdDevice            5.43\n  iManufacturer           1 Yubico\n  iProduct                2 YubiKey CCID\n  iSerial                 0<\/code><\/pre>\n\n\n\n<p>that&#8217;s the key part: idVendor=<strong>0x1050<\/strong>, idProduct=<strong>0x0404<\/strong>. i&#8217;ve put them to the \/etc\/libvirt\/qemu\/w2.xml &#8211; definition of my VM, in &lt;devices&gt; section<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;hostdev mode='subsystem' type='usb' managed='yes'&gt;\n  &lt;source&gt;\n    &lt;vendor id='<strong>0x1050<\/strong>'\/&gt;\n    &lt;product id='<strong>0x0404<\/strong>'\/&gt;\n  &lt;\/source&gt;\n  &lt;address type='usb' bus='0' port='2'\/&gt;\n&lt;\/hostdev&gt;<\/code><\/pre>\n\n\n\n<p>then <em>virsh define \/etc\/libvirt\/qemu\/w2.xml<\/em> and <em>virsh start w2<\/em>.<\/p>\n\n\n\n<p>from now on &#8211; use VNC and not RDP to connect to the Windows VM. Why? Because RDP, intentionally, <a href=\"https:\/\/stackoverflow.com\/questions\/27299106\/why-is-remote-smartcard-not-found-when-using-rdp\">makes it impossible<\/a> to access smartcard\/security devices that are attached to Windows machine to which you&#8217;re connecting. <\/p>\n\n\n\n<p>in the device manager of Windows i can see the smartcard device, with a warning &#8211; that&#8217;s a good sign:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"466\" height=\"507\" src=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image.png\" alt=\"\" class=\"wp-image-3575\" srcset=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image.png 466w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-276x300.png 276w\" sizes=\"auto, (max-width: 466px) 100vw, 466px\" \/><\/figure>\n\n\n\n<p>if you have more than one identical yubikey plugged into the physical server and want to pass just one of them &#8211; it&#8217;s possible to <a href=\"https:\/\/unix.stackexchange.com\/a\/697084\">pass whatever is attached to a specific port<\/a>. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">making Yubikey actually work on the Windows VM<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>install Yubikey&#8217;s <a href=\"https:\/\/www.yubico.com\/support\/download\/smart-card-drivers-tools\/\">minidriver for windows 64 bit <\/a> <\/li>\n\n\n\n<li>install <a href=\"https:\/\/www.yubico.com\/support\/download\/yubikey-manager\/\">Yubikey Manager<\/a><\/li>\n\n\n\n<li>reboot the Windows VM<\/li>\n\n\n\n<li>at this stage &#8211; yubikey manager will not see the key and will tell <em>insert your yubikey<\/em><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"574\" src=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-1-1024x574.png\" alt=\"\" class=\"wp-image-3576\" srcset=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-1-1024x574.png 1024w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-1-300x168.png 300w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-1-768x430.png 768w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-1.png 1149w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>now the key part &#8211; based on <a href=\"https:\/\/github.com\/OpenSC\/OpenSC\/issues\/2541#issuecomment-1285672570\">this thread<\/a> &#8211; in the <em>Device Manager<\/em> &#8211; double blick on the <em>Microsoft Usbccid Smartcard Reader (UMDF2) <\/em>go to <em>Driver<\/em> &gt; <em>Update Driver, Browser my computer for drivers<\/em> <em>Let me pick from a list of available drivers on my computer<\/em> and select <em>Micrososft Usbccid Smartcard Reader<\/em> <em>(WUDF)<\/em><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"719\" src=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-2-1024x719.png\" alt=\"\" class=\"wp-image-3577\" srcset=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-2-1024x719.png 1024w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-2-300x211.png 300w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-2-768x539.png 768w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-2.png 1237w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Yubikey token should immediately show up in the <em>Yubikey Manager<\/em>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"532\" src=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-3-1024x532.png\" alt=\"\" class=\"wp-image-3578\" style=\"width:840px;height:auto\" srcset=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-3-1024x532.png 1024w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-3-300x156.png 300w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-3-768x399.png 768w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-3.png 1433w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">signing a binary in the Windows VM<\/h2>\n\n\n\n<p>install signtool from <a href=\"https:\/\/developer.microsoft.com\/en-us\/windows\/downloads\/windows-sdk\/\">https:\/\/developer.microsoft.com\/en-us\/windows\/downloads\/windows-sdk\/<\/a> &#8211; it&#8217;s enough to select <em>Windows SDK Signing Tools for Desktop Apps<\/em><\/p>\n\n\n\n<p>run <em>certmgr.msc <\/em>, find your certificate, double click on it, go to <em>Details<\/em> and scroll down to the <em>Thumbprint<\/em> &#8211; it&#8217;s the hash we&#8217;ll use to identify cert that should be used in the signing process<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"973\" height=\"564\" src=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-4.png\" alt=\"\" class=\"wp-image-3579\" srcset=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-4.png 973w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-4-300x174.png 300w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-4-768x445.png 768w\" sizes=\"auto, (max-width: 973px) 100vw, 973px\" \/><\/figure>\n\n\n\n<p>add <em>c:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.22621.0\\x64 <\/em>to path to make signtool easily accessible from command line, providing &#8211; as the long hex &#8211; thumbprint of your cert:<\/p>\n\n\n\n<p><em><em>signtool.exe sign \/sha1 2ad5caaad3caf23baa33a2ad7a6eaaf18255a7c7 \/fd sha256 \/td sha256 \/tr <\/em><\/em><a href=\"http:\/\/timestamp.digicert.com\/\" target=\"_blank\" rel=\"noreferrer noopener\"><em>http:\/\/timestamp.digicert.com<\/em><\/a><em><em> &#8220;Clear Settings Wizard.exe&#8221;<\/em><\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"951\" height=\"409\" src=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-5.png\" alt=\"\" class=\"wp-image-3580\" srcset=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-5.png 951w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-5-300x129.png 300w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-5-768x330.png 768w\" sizes=\"auto, (max-width: 951px) 100vw, 951px\" \/><\/figure>\n\n\n\n<p>if all went fine &#8211; signature on the exe should be replaced with yours<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"415\" src=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-6-1024x415.png\" alt=\"\" class=\"wp-image-3581\" srcset=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-6-1024x415.png 1024w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-6-300x122.png 300w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-6-768x311.png 768w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2023\/12\/image-6.png 1421w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>again &#8211; above will not work if you RDP &#8211; yubikey manager will tell <em>Insert your YubiKey, <\/em>signtool will ask to select a smartcard device, and tell &#8220;No certificates were found that met all the given criteria&#8221;.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">signing without need to manually enter the PIN each time <\/h2>\n\n\n\n<p>I&#8217;ve found few options for unattended \/ fully automated signing, without prompt for pin, with Yubikey:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>scsigntool &#8211; https:\/\/www.mgtek.com\/smartcard &#8211; free, but closed source and fairly obscure. seems to work fine, but i&#8217;d prefer to have more transparency<\/li>\n\n\n\n<li><a href=\"https:\/\/eur03.safelinks.protection.outlook.com\/?url=https%3A%2F%2Febourg.github.io%2Fjsign%2F&amp;data=05%7C01%7CPawel.Kudzia%40macrobond.com%7Ce2a6bc683e224ad9bb7608dbf1b6e59e%7Cbea9cb3aae594ea5a0deb3371fe41dd4%7C1%7C0%7C638369540078247654%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=hCKRZFaSE7sT7Vly7qI5SkzUVngd38vWhRGpwAsBaNk%3D&amp;reserved=0\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/ebourg.github.io\/jsign\/<\/a> &#8211; which requires Java and seems to work fine; you&#8217;ll need to install <a href=\"https:\/\/developers.yubico.com\/yubico-piv-tool\/Releases\/\">Yubico-piv-tools<\/a> and add <em>C:\\Program Files\\Yubico\\Yubico&nbsp;PIV Tool\\bin <\/em>to <em>PATH<\/em>.<\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/mtrojnar\/osslsigncode\">osslsigncode<\/a> might support it, i did not try. details: <a href=\"https:\/\/github.com\/Yubico\/yubico-piv-tool\/issues\/21\">1<\/a>, <a href=\"https:\/\/stackoverflow.com\/a\/77200108\/104398\">2<\/a>.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>java -jar jsign-5.0.jar -tsaurl http:\/\/timestamp.sectigo.com --storetype YUBIKEY --storepass MYPIN --replace yubico-piv-tool-2.3.1-win64.msi\nERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...\nAdding Authenticode signature to yubico-piv-tool-2.3.1-win64.msi<\/code><\/pre>\n\n\n\n<p>i&#8217;m sure it&#8217;s possible to specify which cert to use, but i don&#8217;t know how to do it. anyway &#8211; this seems to work.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>reminder: access to local smartcard is not possible via RDP, i was getting this error when trying to use jsign via RDP instead of VNC:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>jsign: Failed to load the keystore\njava.security.KeyStoreException: keystore type 'YUBIKEY' is not supported with security provider SunPKCS11-yubikey\n        at net.jsign.KeyStoreType.getKeystore(KeyStoreType.java:474)\n        at net.jsign.KeyStoreBuilder.build(KeyStoreBuilder.java:283)\n        at net.jsign.SignerHelper.build(SignerHelper.java:256)\n        at net.jsign.SignerHelper.sign(SignerHelper.java:388)\n        at net.jsign.JsignCLI.execute(JsignCLI.java:132)\n        at net.jsign.JsignCLI.main(JsignCLI.java:40)\nCaused by: java.security.KeyStoreException: PKCS11 not found\n        at java.base\/java.security.KeyStore.getInstance(KeyStore.java:967)\n        at net.jsign.KeyStoreType.getKeystore(KeyStoreType.java:469)\n        ... 5 more\nCaused by: java.security.NoSuchAlgorithmException: no such algorithm: PKCS11 for provider SunPKCS11-yubikey\n        at java.base\/sun.security.jca.GetInstance.getService(GetInstance.java:101)\n        at java.base\/sun.security.jca.GetInstance.getInstance(GetInstance.java:218)\n        at java.base\/java.security.Security.getImpl(Security.java:684)\n        at java.base\/java.security.KeyStore.getInstance(KeyStore.java:964)\n        ... 6 more\nTry `java -jar jsign.jar --help' for more information.\n<\/code><\/pre>\n\n\n\n<p>looks like there&#8217;s a way around it, but requires binary patching: <a href=\"https:\/\/lifayk.blogspot.com\/2012\/07\/windows-smart-card-subsystem-and-remote.html\">1<\/a>, <a href=\"https:\/\/stackoverflow.com\/questions\/27375364\/how-to-access-remote-usb-smartcard-during-rdp\">2<\/a>, <a href=\"https:\/\/stackoverflow.com\/a\/73049906\/104398\">3<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Extended Validation code signing certificates<\/h2>\n\n\n\n<p>few weeks after buying OV Code Signing cert from ssl.com and testing if all works fine i&#8217;ve bought proper EV certs to be used in the next 3 years &#8211; one from ssl.com another from sectigo via ssl2buy.com. vetting process was very similar for both OV and EV certs &#8211; it was based on call to number found in company registration papers. installation and use of EV certs was identical to OV. in case of sectigo besides getting the requested cert, i&#8217;ve received two intermediary certs and root cert. i&#8217;ve installed them via:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd C:\\Program Files\\Yubico\\YubiKey Manager\r\nykman.exe piv certificates import 82 C:\\sectigo\\out\\root.crt -m managementkey\r\nykman.exe piv certificates import 83 C:\\sectigo\\out\\int1.crt -m managementkey\r\nykman.exe piv certificates import 84 C:\\sectigo\\out\\int2.crt -m managementkey\r\n\r\n<\/code><\/pre>\n\n\n\n<p>  <\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>starting from June 2023 code signing certificates for MS Windows cannot be delivered as a file anymore. files are easy to steal. now certs must reside on security modules which don&#8217;t allow private key extraction, at least not for mere mortals. we&#8217;re using such a cert to sign exe and msi files on a build [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3567","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3567","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/comments?post=3567"}],"version-history":[{"count":9,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3567\/revisions"}],"predecessor-version":[{"id":3595,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3567\/revisions\/3595"}],"wp:attachment":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/media?parent=3567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/categories?post=3567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/tags?post=3567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}