コード例 #1
0
ファイル: NativeOpenSsl.cs プロジェクト: nagyist/mono-tls
        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);
        }
コード例 #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");
            }
        }
コード例 #3
0
ファイル: NativeOpenSsl.cs プロジェクト: VimalKumarS/mono-tls
		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);
		}
コード例 #4
0
ファイル: NativeOpenSsl.cs プロジェクト: VimalKumarS/mono-tls
		extern static OpenSslHandle native_openssl_initialize (int debug, NativeOpenSslProtocol protocol, DebugCallback debug_callback, MessageCallback message_callback);
コード例 #5
0
ファイル: NativeOpenSsl.cs プロジェクト: nagyist/mono-tls
 extern static OpenSslHandle native_openssl_initialize(int debug, NativeOpenSslProtocol protocol, DebugCallback debug_callback, MessageCallback message_callback);
コード例 #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");
		}