Skip to content

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleepw4lker committed Dec 30, 2022
1 parent d498974 commit 1ee1a44
Showing 1 changed file with 8 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ public static bool TryInitializeFromInnerRequest(this IX509CertificateRequestPkc

try
{
certificateRequestCmc.InitializeDecode(
certificateRequest,
EncodingType.XCN_CRYPT_STRING_BASE64_ANY
);
certificateRequestCmc.InitializeDecode(certificateRequest,
EncodingType.XCN_CRYPT_STRING_BASE64_ANY);

var innerRequest = certificateRequestCmc.GetInnerRequest(InnerRequestLevel.LevelInnermost);
certificateRequest = innerRequest.get_RawData();
Expand All @@ -88,10 +86,8 @@ public static bool TryInitializeFromInnerRequest(this IX509CertificateRequestPkc

try
{
certificateRequestPkcs7.InitializeDecode(
certificateRequest,
EncodingType.XCN_CRYPT_STRING_BASE64_ANY
);
certificateRequestPkcs7.InitializeDecode(certificateRequest,
EncodingType.XCN_CRYPT_STRING_BASE64_ANY);

var innerRequest = certificateRequestPkcs7.GetInnerRequest(InnerRequestLevel.LevelInnermost);
certificateRequest = innerRequest.get_RawData();
Expand All @@ -110,10 +106,7 @@ public static bool TryInitializeFromInnerRequest(this IX509CertificateRequestPkc

try
{
certificateRequestPkcs10.InitializeDecode(
certificateRequest,
EncodingType.XCN_CRYPT_STRING_BASE64_ANY
);
certificateRequestPkcs10.InitializeDecode(certificateRequest, EncodingType.XCN_CRYPT_STRING_BASE64_ANY);
}
catch
{
Expand All @@ -127,14 +120,9 @@ public static string GetKeyAlgorithmName(this IX509CertificateRequestPkcs10 cert
{
switch (certificateRequestPkcs10.PublicKey.Algorithm.Value)
{
case WinCrypt.szOID_ECC_PUBLIC_KEY:
return "ECC";

case WinCrypt.szOID_RSA_RSA:
return "RSA";

default:
return certificateRequestPkcs10.PublicKey.Algorithm.Value;
case WinCrypt.szOID_ECC_PUBLIC_KEY: return "ECC";
case WinCrypt.szOID_RSA_RSA: return "RSA";
default: return certificateRequestPkcs10.PublicKey.Algorithm.Value;
}
}

Expand Down Expand Up @@ -177,10 +165,6 @@ public static Dictionary<string, string> GetInlineRequestAttributeList(
attributeList.Add("ProcessName", clientId.ProcessName.ToLowerInvariant());
attributeList.Add("MachineDnsName", clientId.MachineDnsName);
}
catch
{
// we don't want an exception to be thrown
}
finally
{
Marshal.ReleaseComObject(clientId);
Expand Down

0 comments on commit 1ee1a44

Please sign in to comment.