B1: Sử dụng code powershell sau đây để tạo file hello.exe
$code = @”
using System;
public class HelloWorld {
public static void Main() {
Console.WriteLine(“Hello World”);
Console.ReadLine();
}
}
“@Add-Type -TypeDefinition $code -OutputAssembly “hello.exe” -OutputType ConsoleApplication
B2: chạy thử hello.exe để xem kết quả

B3: Tạo certificate giả mạo “Microsoft Corporation” bằng code powershell sau đây
# Định nghĩa thông tin certificate giống Microsoft
$certName = “CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US”
$pfxPath = “$env:USERPROFILE\Desktop\FakeMicrosoftCert.pfx”
$pfxPassword = ConvertTo-SecureString -String “P@ssw0rd!” -Force -AsPlainText
# Tạo certificate tự ký (Self-Signed) với khả năng Code Signing
$cert = New-SelfSignedCertificate `
-Subject $certName `
-Type CodeSigningCert `
-KeyUsage DigitalSignature `
-KeyExportPolicy Exportable `
-KeyAlgorithm RSA `
-KeyLength 2048 `
-HashAlgorithm SHA256 `
-CertStoreLocation “Cert:\CurrentUser\My” `
-NotAfter (Get-Date).AddYears(5)
# Xuất ra file .pfx
Export-PfxCertificate -Cert $cert -FilePath $pfxPath -Password $pfxPassword
Write-Output “✅ Certificate created and exported to $pfxPath”
B4: Hiện tại mình đã có 2 file exe và pfx

B5: Kiểm tra file hello.exe sau khi đã giả certificate
