Skip to content
Open
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
11 changes: 10 additions & 1 deletion Rubeus/lib/Ask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,17 @@ public class Ask
// with private key otherwise use users certificate store along with any smartcard that maybe present.
public static X509Certificate2 FindCertificate(string certificate, string storePassword) {

if (File.Exists(certificate)) {
if (File.Exists(certificate))
{

string certificateData = File.ReadAllText(certificate);

//Check if the file content is actually base64 encoded
if (Helpers.IsBase64String(certificateData))
return new X509Certificate2(Convert.FromBase64String(certificateData), storePassword);

return new X509Certificate2(certificate, storePassword);

} else {

X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
Expand Down