How migrate key reading DH-Pem in Delphi-Indy-SSL to C# on .NET 6.0?

83 views Asked by At

dhparam.par

-----BEGIN DH PARAMETERS-----
...==
-----END DH PARAMETERS-----

Indy OpenSSL:

object IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL
Destination = 'smtp.server:587'
Host = 'smtp.server'
MaxLineAction = maException
Port = 587
DefaultPort = 0
SSLOptions.DHParamsFile = 'dhparam.pem'
SSLOptions.Method = sslvTLSv1_2
SSLOptions.SSLVersions = [sslvTLSv1_2]
SSLOptions.Mode = sslmUnassigned
SSLOptions.VerifyMode = []
SSLOptions.VerifyDepth = 0

What default of other settings will Indy OpenSSL read then? Autodetection?

How to read this file dhparam.par in C# on .NET 6.0?

byte[] dhParams = LoadKey(DhParamsFilePath);
var diffieHellman = new ECDiffieHellmanCng()
                    diffieHellman.KeyDerivationFunction = ECDiffieHellmanKeyDerivationFunction.Hash;
                    diffieHellman.HashAlgorithm = CngAlgorithm.Sha256;

                    diffieHellman.ImportParameters(new ECParameters
                    {
                        Q = new ECPoint
                        {
                            X = dhParams, 
                            Y = dhParams
                        },
                        Curve = ECCurve.NamedCurves. ????
                });

Is there any clever NuGet that would read this analogously to Delphi Indy OpenSSL?

0

There are 0 answers