Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows native certutil.exe command #20

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Certify/Lib/Cert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ public static void RequestCert(string CA, bool machineContext = false, string te

Console.WriteLine(
"\r\n[*] Convert with: openssl pkcs12 -in cert.pem -keyex -CSP \"Microsoft Enhanced Cryptographic Provider v1.0\" -export -out cert.pfx\r\n");
"\r\n[*] or (with the keyfile named cert.key): certutil.exe -MergePFX cert.pem cert.pfx");
}


Expand Down Expand Up @@ -401,6 +402,7 @@ public static void RequestCertOnBehalf(string CA, string templateName, string on
Console.WriteLine(certPemString);
Console.WriteLine(
"\r\n[*] Convert with: openssl pkcs12 -in cert.pem -keyex -CSP \"Microsoft Enhanced Cryptographic Provider v1.0\" -export -out cert.pfx\r\n");
"\r\n[*] or (with the keyfile named cert.key): certutil.exe -MergePFX cert.pem cert.pfx");
}
catch (Exception e)
{
Expand Down Expand Up @@ -536,4 +538,4 @@ private static string GetCurrentComputerDN()
return $"CN={System.Net.Dns.GetHostEntry("").HostName}";
}
}
}
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ Certificates can be transformed to .pfx's usable with Certify with:

openssl pkcs12 -in cert.pem -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out cert.pfx

The same can be done usig the Windows native tool `certutil.exe` (with the keyfile named `cert.key`):

certutil.exe -MergePFX cert.pem cert.pfx

Certificates can be used with Rubeus to request a TGT with:

Rubeus.exe asktgt /user:X /certificate:C:\Temp\cert.pfx /password:<CERT_PASSWORD>
Expand Down