0

I have an application written in dotnet framework that I am porting over to dotnet 5 (and probably soon after to dotnet 6).

Right now it uses the ICertRequest interface (Win32 API) to submit a CSR to our on prem CA. I can't for the life of me find how to do this in purely managed dotnet code.

I've looked all over the System.Security.Cryptography namespace and can't find anything. Please help?

I would also prefer to not use BouncyCastle.

Dbloom
  • 1,302
  • 3
  • 18
  • 45

1 Answers1

1

Is there any equivalent to ICertRequest in dotnet 5 or dotnet 6?

No.

The closest analogue is the CertificateRequest class, which can be used to build up a certificate request or to make certificates programmatically. Submitting the request to a CA and receiving the response are left as exercises to the caller.

Since the COM certificate enrollment is a Windows-specific feature set, and .NET is now a cross-platform product, there isn't likely to be a direct version of it that ships as part of .NET itself.

There may or may not be community packages that wrap ICertRequest/ICEnroll.

bartonjs
  • 30,352
  • 2
  • 71
  • 111
  • "Submitting the request to a CA and receiving the response are left as exercises to the caller." Well that's a bummer because I am the caller. Since this functionality likely won't ever be put into .NET now that it is cross platform what does Microsoft expect developers to do? How do we do what we used to do in dotnet framework? – Dbloom Nov 04 '21 at 16:46
  • 1
    @Dbloom If you’re using COM interop on Windows with .NET Framework, that’ll work just fine with Windows on .NET (nee Core). It just won’t work on Linux/Mac/etc. – bartonjs Nov 04 '21 at 17:45
  • Did you mean (new Core)? If so, are you saying that COM interop still works in .NET 5+ on Windows? So my existing code should still work? Maybe it was a misunderstanding on my part that COM interop would not work on .NET 5+. – Dbloom Nov 04 '21 at 18:29
  • 1
    “née”: originally called. “.NET Core” is now just “.NET”. And, yes, COM interop still works (on Windows) – bartonjs Nov 04 '21 at 18:30
  • Well I learned a new word today. Thanks for all your help. – Dbloom Nov 04 '21 at 18:37
  • For CER generation and Cert Download from modern browsers, please refer to https://stackoverflow.com/a/68556286/9659885 – Bharat Vasant Nov 24 '21 at 08:00