| | 35 | |
| | 36 | After downloading either one of the openocd[-x64]-0.5.0-dev windows binaries, one can find the libusb-win32_ft2232_driver-101028.zip archive in the drivers/ directory. |
| | 37 | After further extracting that archive, you will find that it contains an inf file, along with the amd64/ and x86/ containing the the actual driver binaries. If you look at the binaries' properties, on the Digital Signatures tab, you will find that they have already been signed by the libusb-win32 developers (so that they can be installed on Windows outside of test mode). This is not a problem as the signature we are going to create is going to replace any existing one. If you were to recompile the [https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/ libusb-win32] drivers from source, you would of course have no signature. And of course, since there is no signed .cat, the inf is also not signed. |
| | 38 | |
| | 39 | '''Timestamping''' |
| | 40 | |
| | 41 | While using a trusted time source for signature creation or validation is something you should always consider when using PKI, the reason you want to use timestamping from a trusted timestamping authority when signing your drivers is because it ensures that they can still be used in Windows after the code signing certificate expires. If you don't use timestamping when signing your driver files, then you will have to provide all your users with updated drivers if your original certificate expired. For instance, if you purchased a one year certificate and didn't timestamp, your drivers will cease functioning after one year. |
| | 42 | |
| | 43 | Windows Authenticode Certifications Authorities usually provide a timestamping service (usually a dll) that you can reference when signing. Currently these URLs are: |
| | 44 | * http://timestamp.verisign.com/scripts/timstamp.dll (Verisign) |
| | 45 | * http://timestamp.globalsign.com/scripts/timstamp.dll (GlobalSign) |
| | 46 | |
| | 47 | '''Additional Certificate''' |
| | 48 | |
| | 49 | While the Windows certificate store has both the GlobalSign and Verisign root CA certificates as Trusted Root Certification Authorities, these CA certificates are not the ones used for driver code signing. Instead Microsoft have their own "Microsoft Code Verification Root" certificate (which, curiously, will not appear at the top of the certification chain for signed code certificates), which they used to sign the root certificate used by the Certification Authorities they entrusted to provide Authenticode credentials to customers. Microsoft calls that a cross certificate. |
| | 50 | |
| | 51 | By default however, Windows platforms only have the Microsoft Code Verification Root certificate installed, not the the ones from subsidiaries, therefore, to be able to validate the trust chain, the CA's Authenticode root certificate must also be provided. |
| | 52 | |
| | 53 | In short, this means that you will also need to download the root Authenticode certificate from, GlobalSign, Verisign or your other third party authority, so that it can be embedded in the signature. Currently, these certificates can be obtained from: |
| | 54 | * http://www.microsoft.com/whdc/driver/install/drvsign/crosscert.mspx#EWAAC (Verisign) |
| | 55 | * http://www.microsoft.com/whdc/driver/install/drvsign/crosscert.mspx#EMG (GlobalSign) |
| | 56 | For the record, all the certificates above seem set to expire on 2016.05.23. What happens to Windows signed driver users past that date is something that probably warrants some testing... [TODO] |
| | 57 | |
| | 58 | Hint: For some weird reasons, Microsoft thought it was a good idea to provide these certificates in the form of an executable. If you want to extract certificate without running the exe, just open it in [http://www.7-zip.org/ 7-Zip], then open the _winzip_ file you'll find there, and you'll get to the MSCV-GlobalSign.cer or MSCV-VSClass3.cer certificates. |
| | 59 | |
| | 60 | '''Signing process''' |
| | 61 | |
| | 62 | With your driver signing .pfx file, the corresponding private key password, the MSVC-#### certificate above and the timestamp URL, you are now good to sign your driver files. |
| | 63 | It is probably a good idea to place the CA certificate along with your pfx in an easily accessible directory. In the example below, we will use the akeo.pfx driver signing credentials, obtained from GlobalSign, as well as MSCV-GlobalSign.cer from the D:codesign directory. The timestamping authority will also be the one from GlobalSign. |
| | 64 | Preferably you want to sign all the driver files, including the DLLs, but technically, only the .sys should be required. |
| | 65 | |
| | 66 | To sign the file, open one of the WDK dos prompts (eg. Windows XP x86 Free Build Environment), then navigate to the directory containing the driver files you want to sign (eg "libusb-win32_ft2232_driver-101028amd64libusb0.sys" and issue the following: |
| | 67 | |
| | 68 | {{{ |
| | 69 | D:libusb-win32_ft2232_driver-101028amd64>signtool sign /v /ac D:codesignMSCV-GlobalSign.cer /f D:codesignakeo.pfx /p "<YOUR_PASSWORD>" /t http://timestamp.globalsign.com/scripts/timstamp.dll libusb0.sys |
| | 70 | The following certificate was selected: |
| | 71 | Issued to: Akeo Consulting |
| | 72 | Issued by: GlobalSign ObjectSign CA |
| | 73 | Expires: Sun Jun 26 10:05:35 2011 |
| | 74 | SHA1 hash: 0BF5319EE093F9234D8504527D63CFAFEADEECF8 |
| | 75 | |
| | 76 | Cross certificate chain (using machine store): |
| | 77 | Issued to: Microsoft Code Verification Root |
| | 78 | Issued by: Microsoft Code Verification Root |
| | 79 | Expires: Sat Nov 01 13:54:03 2025 |
| | 80 | SHA1 hash: 8FBE4D070EF8AB1BCCAF2A9D5CCAE7282A2C66B3 |
| | 81 | |
| | 82 | Issued to: GlobalSign Root CA |
| | 83 | Issued by: Microsoft Code Verification Root |
| | 84 | Expires: Mon May 23 17:10:51 2016 |
| | 85 | SHA1 hash: 3EEB2750A199F5E7B6A8952430BE5062FE04E9E5 |
| | 86 | |
| | 87 | Issued to: GlobalSign Primary Object Publishing CA |
| | 88 | Issued by: GlobalSign Root CA |
| | 89 | Expires: Fri Jan 27 12:00:00 2017 |
| | 90 | SHA1 hash: 1AAF4DF10D36215E09E4EEFD70E340C2E4DECF38 |
| | 91 | |
| | 92 | Issued to: GlobalSign ObjectSign CA |
| | 93 | Issued by: GlobalSign Primary Object Publishing CA |
| | 94 | Expires: Fri Jan 27 11:00:00 2017 |
| | 95 | SHA1 hash: B859853EF366AC9335763C340A87BD208113055F |
| | 96 | |
| | 97 | Issued to: Akeo Consulting |
| | 98 | Issued by: GlobalSign ObjectSign CA |
| | 99 | Expires: Sun Jun 26 10:05:35 2011 |
| | 100 | SHA1 hash: 0BF5319EE093F9234D8504527D63CFAFEADEECF8 |
| | 101 | |
| | 102 | Done Adding Additional Store |
| | 103 | Successfully signed and timestamped: libusb0.sys |
| | 104 | |
| | 105 | Number of files successfully Signed: 1 |
| | 106 | Number of warnings: 0 |
| | 107 | Number of errors: 0 |
| | 108 | }}} |
| | 109 | |
| | 110 | '''checking the signed driver files''' |
| | 111 | |
| | 112 | Optional, but probably a good idea, as you will get the timestamping info as well. |
| | 113 | {{{ |
| | 114 | D:libusb-win32_ft2232_driver-101028amd64>signtool verify /kp /v libusb0.sys |
| | 115 | |
| | 116 | Verifying: libusb0.sys |
| | 117 | Hash of file (sha1): B4C09901487067EB10454F6CFFCFA3C64988EE86 |
| | 118 | |
| | 119 | Signing Certificate Chain: |
| | 120 | Issued to: GlobalSign Root CA |
| | 121 | Issued by: GlobalSign Root CA |
| | 122 | Expires: Fri Jan 28 12:00:00 2028 |
| | 123 | SHA1 hash: B1BC968BD4F49D622AA89A81F2150152A41D829C |
| | 124 | |
| | 125 | Issued to: GlobalSign Primary Object Publishing CA |
| | 126 | Issued by: GlobalSign Root CA |
| | 127 | Expires: Fri Jan 27 12:00:00 2017 |
| | 128 | SHA1 hash: 1AAF4DF10D36215E09E4EEFD70E340C2E4DECF38 |
| | 129 | |
| | 130 | Issued to: GlobalSign ObjectSign CA |
| | 131 | Issued by: GlobalSign Primary Object Publishing CA |
| | 132 | Expires: Fri Jan 27 11:00:00 2017 |
| | 133 | SHA1 hash: B859853EF366AC9335763C340A87BD208113055F |
| | 134 | |
| | 135 | Issued to: Akeo Consulting |
| | 136 | Issued by: GlobalSign ObjectSign CA |
| | 137 | Expires: Sun Jun 26 10:05:35 2011 |
| | 138 | SHA1 hash: 0BF5319EE093F9234D8504527D63CFAFEADEECF8 |
| | 139 | |
| | 140 | The signature is timestamped: Tue Feb 08 13:54:32 2011 |
| | 141 | Timestamp Verified by: |
| | 142 | Issued to: GlobalSign Root CA |
| | 143 | Issued by: GlobalSign Root CA |
| | 144 | Expires: Fri Jan 28 12:00:00 2028 |
| | 145 | SHA1 hash: B1BC968BD4F49D622AA89A81F2150152A41D829C |
| | 146 | |
| | 147 | Issued to: GlobalSign Timestamping CA |
| | 148 | Issued by: GlobalSign Root CA |
| | 149 | Expires: Fri Jan 28 12:00:00 2028 |
| | 150 | SHA1 hash: 958D23902D5448314F2F811034356A58255CDC9B |
| | 151 | |
| | 152 | Issued to: GlobalSign Time Stamping Authority |
| | 153 | Issued by: GlobalSign Timestamping CA |
| | 154 | Expires: Tue Dec 22 09:32:56 2020 |
| | 155 | SHA1 hash: AEDF7DF76BBA2410D67DBAF18F5BA15B417E496C |
| | 156 | |
| | 157 | Cross Certificate Chain: |
| | 158 | Issued to: Microsoft Code Verification Root |
| | 159 | Issued by: Microsoft Code Verification Root |
| | 160 | Expires: Sat Nov 01 13:54:03 2025 |
| | 161 | SHA1 hash: 8FBE4D070EF8AB1BCCAF2A9D5CCAE7282A2C66B3 |
| | 162 | |
| | 163 | Issued to: GlobalSign Root CA |
| | 164 | Issued by: Microsoft Code Verification Root |
| | 165 | Expires: Mon May 23 17:10:51 2016 |
| | 166 | SHA1 hash: 3EEB2750A199F5E7B6A8952430BE5062FE04E9E5 |
| | 167 | |
| | 168 | Issued to: GlobalSign Primary Object Publishing CA |
| | 169 | Issued by: GlobalSign Root CA |
| | 170 | Expires: Fri Jan 27 12:00:00 2017 |
| | 171 | SHA1 hash: 1AAF4DF10D36215E09E4EEFD70E340C2E4DECF38 |
| | 172 | |
| | 173 | Issued to: GlobalSign ObjectSign CA |
| | 174 | Issued by: GlobalSign Primary Object Publishing CA |
| | 175 | Expires: Fri Jan 27 11:00:00 2017 |
| | 176 | SHA1 hash: B859853EF366AC9335763C340A87BD208113055F |
| | 177 | |
| | 178 | Issued to: Akeo Consulting |
| | 179 | Issued by: GlobalSign ObjectSign CA |
| | 180 | Expires: Sun Jun 26 10:05:35 2011 |
| | 181 | SHA1 hash: 0BF5319EE093F9234D8504527D63CFAFEADEECF8 |
| | 182 | |
| | 183 | Successfully verified: libusb0.sys |
| | 184 | |
| | 185 | Number of files successfully Verified: 1 |
| | 186 | Number of warnings: 0 |
| | 187 | Number of errors: 0 |
| | 188 | }}} |