The first thing that comes to mind is typically the certificates used by a web server when we think of SSL/TLS and certificates, and this makes sense because it is by far the most common use for them. The specification for x.509 certificates, however, also has several other applications. The public key in a public/private key pair is a credential (usually generated with RSA or ECDSA).
A code signing certificate is a particular type of certificate used to verify that a binary is authentic. Software developers sign their updates with their private key, and clients can use their public key to decrypt a nonce published along with an attribute in the certificate. Once again, we exploit certificate authorities to build a network of trust around these public keys so that, depending on who publishes them, the machine can trust or mistrust various programs. You might even say CA is making the world go round! An attacker might create a Man-In-The-Middle attack without this mechanism and trick you into running their program instead.
What if you’re a developer who wants to start signing releases with them? You also do have a moral duty to do so in this day and age. If you want to go for a SSl.com code signing certificate or a Comodo, you first need to decide. Comodo is a cheaper choice and is mostly compatible with Windows Drivers, Java Apps, Office Macros, RDP shortcuts, Visual Studio projects, or Silverlight Applications that you want to sign with any binaries. Legacy clients, however, often have difficulty with Comodo certificates because for as long as Thawte, they have not been a player in the game.
Next, your CSR will need to be produced. As downloading the signed certificate combines the publicly trusted certificate with the private key already on your device, you’ll need to create it from the machine you want to use to sign the code! Depending on whether you will sign Windows Code or a Java Application, this method varies a little bit.
Generating a CSR for signing Windows Code:
Open certmgr.msc
- Right-click the “Personal” node.
- Navigate to All Tasks > Advanced Operations > Custom Request creation.
“Proceed without enrollment policy”
Request Format, PKCS #10, and select Next.
Expand Details and select Properties.
You need to assign the certificate a descriptive and welcoming name under the General tab.
For the following attributes, please provide a valid value:
- Popular Name- The company’s name.
- Organization – The name of your business.
- Locality – The physical location of your business
- State – The territory
- Country – country your business operates in.
add
- “digital signature”
- “key encipherment”
- “signing the key certificate”
Be sure to incorporate Code Signing under Extender Key Use (Application Policies).
Make your key size at least 2048 under “Private Key.” “Pick “Make exportable your private key”. “DO NOT pick “Solid security of private key”. “Pick “Sha256” under the Hash algorithm. Only click OK.
Click Next and export to the Base 64 format of your CSR. Open it in the notepad and paste the contents of the certificate you have ordered into the SSL Configuration Panel so that we can process your request for certificates. Note that Internet Explorer or Chrome should be used because Firefox operates its Certificate Store and will not perform as planned.
Installing Windows Certificates:
Until you have obtained your certificate (it can take up to 3 business days to check your identity correctly), you can sign your binary with this key pair. You will need to install it in the Keystore on your computer. To install a certificate, use Internet Explorer and it will combine this signed certificate with the private key you developed when you built your CSR. By navigating to the “local machine certificates” panel in the Windows MMC Utility, you can make a password-protected backup of your key pair.
Installing Java Certificates:
Signing Windows Applications with Authenticode
install the Windows SDK for your os
- https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk
- https://developer.microsoft.com/en-us/windows/downloads/windows-8-1-sdk
- https://www.microsoft.com/en-us/download/details.aspx?id=8279
Assuming that your user account is bound to a single Code Signing Certificate,
signtool sign /t http://sha256timestamp.ws.symantec.com/sha256/timestamp /a “c:pathtofile.exe”
The best thing to do if you have multiple Code Signing Certificates is to export a.PFX from the MMC and define it:
Java CSR and Signing Codes Installing Certificate
Java Development Kit (JDK) should be installed on your local computer before using these instructions. Wherever you have the key tool command open, you can run the commands in this instruction. Make sure that you keep track of the Keystore file after creating your CSR since it contains your private key. Moreover, to install your Java Code Signing Certificate, you need the Keystore file.
Use the command prompt if you intend to run the commands from a Windows Server in these instructions. For example: C:Program FilesJavajdk1.7.0 02bin.Make sure you are already in your PATH setting with your JDK bin folder. You can also insert a CD into your JDK bin folder and directly execute the keytool from there. If you use this option, you need to transfer them to a more useful location after you build your new Keystore and CSR files.
Generating a CSR for signing Java Code
Keytool should be in the windows path. If not replace it with the full path to “keytool.exe” in each command.
Generate your code signing Keystore:
keytool -genkey -alias comparecheapssl -keyalg RSA -key size 2048 -Keystore comparecheapssl
the CSR of yours. Answer the questions to include the details that you are asked to provide. It will prompt you to create a password, and when you sign binaries, you will need to remember it and supply it.
keytool -certreq -v -alias comparecheapssl -file mycsr.pem -Keystore comparecheapssl
The. PEM file contains the BASE64 CSR to be used for your order on trust during the certificate configuration stage so that we can create your certificate.
Installing Java Certificates:
Signing Java Code:
jarsigner -TSA http://sha256timestamp.ws.symantec.com/sha256/timestamp -Keystore codesign jks -storepass password created above filetosign.jar codesign
you can use the following to check code signatures:
jarsigner -verify -verbose -certs filetosign.jar
Code signing certificates will only provide your customers with protection, but they will pay for themselves in the trust you create with your clientele. By corporate policy, many companies are obligated only to buy goods that use this form for distribution. Get your certificate for code signing today!