public NativeOpenSsl(bool isServer, bool debug, NativeOpenSslProtocol protocol) { this.isServer = isServer; this.enableDebugging = debug; this.protocol = protocol; readHandler = Read_internal; writeHandler = Write_internal; shutdownHandler = Shutdown_internal; if (debug) { debug_callback = new DebugCallback(OnDebugCallback); } message_callback = new MessageCallback(OnMessageCallback); handle = native_openssl_initialize(debug ? 1 : 0, protocol, debug_callback, message_callback); if (handle.IsInvalid) { throw new InvalidOperationException("Handle invalid."); } var ret = native_openssl_create_context(handle, !isServer); CheckError(ret); }
void InitDiffieHellman(NativeOpenSslProtocol protocol) { var dh = new DiffieHellmanManaged(); var dhparams = dh.ExportParameters(true); openssl.SetDhParams(dhparams.P, dhparams.G); // Optional: this is OpenSsl's default value. if (protocol == NativeOpenSslProtocol.TLS12) { openssl.SetNamedCurve("prime256v1"); } }
public NativeOpenSsl (bool isServer, bool debug, NativeOpenSslProtocol protocol) { this.isServer = isServer; this.enableDebugging = debug; this.protocol = protocol; readHandler = Read_internal; writeHandler = Write_internal; shutdownHandler = Shutdown_internal; if (debug) debug_callback = new DebugCallback (OnDebugCallback); message_callback = new MessageCallback (OnMessageCallback); handle = native_openssl_initialize (debug ? 1 : 0, protocol, debug_callback, message_callback); if (handle.IsInvalid) throw new ConnectionException ("Handle invalid."); var ret = native_openssl_create_context (handle, !isServer); CheckError (ret); }
extern static OpenSslHandle native_openssl_initialize (int debug, NativeOpenSslProtocol protocol, DebugCallback debug_callback, MessageCallback message_callback);
extern static OpenSslHandle native_openssl_initialize(int debug, NativeOpenSslProtocol protocol, DebugCallback debug_callback, MessageCallback message_callback);
void InitDiffieHellman (NativeOpenSslProtocol protocol) { var dh = new DiffieHellmanManaged (); var dhparams = dh.ExportParameters (true); openssl.SetDhParams (dhparams.P, dhparams.G); // Optional: this is OpenSsl's default value. if (protocol == NativeOpenSslProtocol.TLS12) openssl.SetNamedCurve ("prime256v1"); }