예제 #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);
        }
예제 #2
0
        public NativeOpenSsl(bool isClient, bool debug)
        {
            this.isClient        = isClient;
            this.enableDebugging = debug;

            if (debug)
            {
                debug_callback = new DebugCallback(OnDebugCallback);
            }

            message_callback = new MessageCallback(OnMessageCallback);

            handle = native_openssl_initialize(debug ? 1 : 0, debug_callback, message_callback);
            if (handle.IsInvalid)
            {
                throw new ConnectionException("Handle invalid.");
            }

            var ret = native_openssl_create_context(handle, isClient);

            CheckError(ret);
        }
예제 #3
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (certificate != null)
         {
             certificate.Dispose();
             certificate = null;
         }
         if (privateKey != null)
         {
             privateKey.Dispose();
             privateKey = null;
         }
         if (handle != null)
         {
             handle.Dispose();
             handle = null;
         }
     }
     base.Dispose(disposing);
 }
예제 #4
0
		extern static int native_openssl_load_certificate_from_pkcs12 (
			OpenSslHandle handle, byte[] buffer, int len,
			[MarshalAs (UnmanagedType.LPStr)] string password, int passlen,
			out CertificateHandle certificate, out PrivateKeyHandle privateKey);
예제 #5
0
		extern static CertificateHandle native_openssl_load_certificate_from_pem (OpenSslHandle handle, byte[] buffer, int len);
예제 #6
0
		extern static int native_openssl_accept (OpenSslHandle handle);
예제 #7
0
		extern static int native_openssl_connect (OpenSslHandle handle, byte[] ip, int port);
예제 #8
0
		extern static int native_openssl_create_connection (OpenSslHandle handle);
예제 #9
0
		extern static int native_openssl_set_named_curve (OpenSslHandle handle, string curve_name);
예제 #10
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);
		}
예제 #11
0
 extern static int native_openssl_accept(OpenSslHandle handle);
예제 #12
0
 extern static int native_openssl_bind(OpenSslHandle handle, byte[] ip, int port);
예제 #13
0
 extern static int native_openssl_connect(OpenSslHandle handle, byte[] ip, int port);
예제 #14
0
 extern static int native_openssl_close(OpenSslHandle handle);
예제 #15
0
 extern static int native_openssl_create_connection(OpenSslHandle handle);
예제 #16
0
 extern static int native_openssl_create_context(OpenSslHandle handle, bool client);
예제 #17
0
		extern static void native_openssl_set_certificate_verify (OpenSslHandle handle, int mode, VerifyCallback verify_cb, CertificateVerifyCallback cert_cb, int depth);
예제 #18
0
		extern static short native_openssl_get_current_cipher (OpenSslHandle handle);
예제 #19
0
 extern static int native_openssl_read(OpenSslHandle handle, byte[] buffer, int offset, int size);
예제 #20
0
 extern static int native_openssl_set_named_curve(OpenSslHandle handle, string curve_name);
예제 #21
0
 extern static CertificateHandle native_openssl_load_certificate_from_pem(OpenSslHandle handle, byte[] buffer, int len);
예제 #22
0
		extern static int native_openssl_create_context (OpenSslHandle handle, bool client);
예제 #23
0
 extern static PrivateKeyHandle native_openssl_load_private_key_from_pem(OpenSslHandle handle, byte[] buffer, int len);
예제 #24
0
		extern static int native_openssl_close (OpenSslHandle handle);
예제 #25
0
 extern static int native_openssl_load_certificate_from_pkcs12(
     OpenSslHandle handle, byte[] buffer, int len,
     [MarshalAs(UnmanagedType.LPStr)] string password, int passlen,
     out CertificateHandle certificate, out PrivateKeyHandle privateKey);
예제 #26
0
		extern static int native_openssl_bind (OpenSslHandle handle, byte[] ip, int port);
예제 #27
0
 extern static int native_openssl_set_certificate(
     OpenSslHandle handle, CertificateHandle certificate, PrivateKeyHandle privateKey);
예제 #28
0
		extern static int native_openssl_read (OpenSslHandle handle, byte[] buffer, int offset, int size);
예제 #29
0
 extern static void native_openssl_set_certificate_verify(OpenSslHandle handle, int mode, VerifyCallback verify_cb, CertificateVerifyCallback cert_cb, int depth);
예제 #30
0
		extern static PrivateKeyHandle native_openssl_load_private_key_from_pem (OpenSslHandle handle, byte[] buffer, int len);
예제 #31
0
 extern static int native_openssl_shutdown(OpenSslHandle handle);
예제 #32
0
		extern static int native_openssl_set_certificate (
			OpenSslHandle handle, CertificateHandle certificate, PrivateKeyHandle privateKey);
예제 #33
0
 extern static short native_openssl_get_current_cipher(OpenSslHandle handle);
예제 #34
0
		extern static int native_openssl_shutdown (OpenSslHandle handle);
예제 #35
0
 extern static int native_openssl_set_cipher_list(OpenSslHandle handle, byte[] ciphers, int count);
예제 #36
0
		extern static int native_openssl_set_cipher_list (OpenSslHandle handle, byte[] ciphers, int count);
예제 #37
0
		extern static int native_openssl_set_dh_params (OpenSslHandle handle, byte[] p, int p_len, byte[] g, int b_len);
예제 #38
0
		protected override void Dispose (bool disposing)
		{
			if (disposing) {
				if (certificate != null) {
					certificate.Dispose ();
					certificate = null;
				}
				if (privateKey != null) {
					privateKey.Dispose ();
					privateKey = null;
				}
				if (handle != null) {
					native_openssl_close (handle);
					handle.Dispose ();
					handle = null;
				}
			}
			base.Dispose (disposing);
		}
예제 #39
0
 extern static int native_openssl_set_dh_params(OpenSslHandle handle, byte[] p, int p_len, byte[] g, int b_len);