Is it possible to generate both a private and public key for WireGuard using C#?
It needs to be in Base64 format, as far as I understand, correct?
I need these keys later to send them to a firewall via SSH.
If yes, how?
Regards, Steffen
Is it possible to generate both a private and public key for WireGuard using C#?
It needs to be in Base64 format, as far as I understand, correct?
I need these keys later to send them to a firewall via SSH.
If yes, how?
Regards, Steffen
Well, in pure C#, that would mean rewriting crypto libraries by hand which no one in their right mind should be doing unless that is their line of work.
So what you are looking for are libraries that you can call from C# to do what you want. Here are the various wireguard libraries and source.
If you are building for Windows, you might want the embeddable-dll-service or WireGuardNT. Details here.
Or if you can interact with openssl from C#, you can use openssl itself to generate valid keys apparently...
This reddit post mentions how to generate wg private/pub key using openssl only (I haven't tested it, ymmv).