Skip to content

Latest commit

 

History

History
73 lines (56 loc) · 2.31 KB

File metadata and controls

73 lines (56 loc) · 2.31 KB

Certificate Generation and Signing

Overview

This guide provides a step-by-step process to create a Certificate Authority (CA), generate a Code-Signing Certificate, and sign executables to enhance their legitimacy.


Steps for Certificate Generation

1. Create a Root Certificate Authority (CA)

Run the following command to generate a Root Certificate Authority:

makecert -r -pe -n "CN=Malwr CA" -ss CA -sr CurrentUser -a sha256 -cy authority -sky signature -sv MalwrCA.pvk MalwrCA.cer

OR

& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\MakeCert.exe" -r -pe -n "CN=Malwr CA" -ss CA -sr CurrentUser -a sha256 -cy authority -sky signature -sv MalwrCA.pvk MalwrCA.cer

2. Import the Root Certificate

Add the generated Root Certificate to the certificate store:

certutil -user -addstore Root MalwrCA.cer

3. Generate a Code-Signing Certificate

Use the following command to create a Code-Signing Certificate:

makecert -pe -n "CN=Malwr Cert" -a sha256 -cy end -sky signature -ic MalwrCA.cer -iv MalwrCA.pvk -sv MalwrCert.pvk MalwrCert.cer

OR

& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\MakeCert.exe" -pe -n "CN=Malwr Cert" -a sha256 -cy end -sky signature -ic MalwrCA.cer -iv MalwrCA.pvk -sv MalwrCert.pvk MalwrCert.cer

4. Convert Certificates to PFX Format

Convert the generated private key and certificate into PFX format:

pvk2pfx -pvk MalwrCert.pvk -spc MalwrCert.cer -pfx MalwrCert.pfx

OR

& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\pvk2pfx.exe" -pvk MalwrCert.pvk -spc MalwrCert.cer -pfx MalwrCert.pfx

Signing the Binary

1. Sign the Executable

Use signtool to sign your binary:

signtool sign /v /f MalwrCert.pfx /t http://timestamp.verisign.com/scripts/timstamp.dll malware1.exe

OR

& "C:\Program Files (x86)\Windows Kits\10\App Certification Kit\signtool.exe" sign /v /f MalwrCert.pfx /fd SHA256 /t http://timestamp.digicert.com malware1.exe

2. Verify the Signature

Ensure the executable has been signed correctly:

signtool verify /pa /v malware1.exe

Conclusion

By following these steps, you can generate certificates and sign binaries to enhance their trustworthiness and reduce detection rates by antivirus engines.