Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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");
            }
        }
Exemplo n.º 3
0
		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);
		}
Exemplo n.º 4
0
		extern static OpenSslHandle native_openssl_initialize (int debug, NativeOpenSslProtocol protocol, DebugCallback debug_callback, MessageCallback message_callback);
Exemplo n.º 5
0
 extern static OpenSslHandle native_openssl_initialize(int debug, NativeOpenSslProtocol protocol, DebugCallback debug_callback, MessageCallback message_callback);
Exemplo n.º 6
0
		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");
		}