AssertNotNull() public static method

public static AssertNotNull ( IntPtr ptr ) : IntPtr
ptr System.IntPtr
return System.IntPtr
Ejemplo n.º 1
0
        private static IntPtr GetMethodFromProtocol(OpenSslProtocol protocol, bool server)
        {
            IntPtr method = IntPtr.Zero;

            switch (protocol)
            {
            case OpenSslProtocol.AutoDetect:
                if (server)
                {
                    method = OpenSslNative.SSLv23_server_method();
                }
                else
                {
                    method = OpenSslNative.SSLv23_client_method();
                }
                break;

            case OpenSslProtocol.SSLv2:
                if (server)
                {
                    method = OpenSslNative.SSLv2_server_method();
                }
                else
                {
                    method = OpenSslNative.SSLv2_client_method();
                }
                break;

            case OpenSslProtocol.SSLv3:
                if (server)
                {
                    method = OpenSslNative.SSLv3_server_method();
                }
                else
                {
                    method = OpenSslNative.SSLv3_client_method();
                }
                break;

            case OpenSslProtocol.TLSv1:
                if (server)
                {
                    method = OpenSslNative.TLSv1_server_method();
                }
                else
                {
                    method = OpenSslNative.TLSv1_client_method();
                }
                break;

            default:
                break;
            }

            return(OpenSslUtility.AssertNotNull(method));
        }
Ejemplo n.º 2
0
 public OpenSslPrivateKey(OpenSslBIO bio)
 {
     _pkey = OpenSslUtility.AssertNotNull(OpenSslNative.PEM_read_bio_PrivateKey(bio.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero));
 }
Ejemplo n.º 3
0
 public static OpenSslBIO FromFile(string file)
 {
     return(new OpenSslBIO(OpenSslUtility.AssertNotNull(OpenSslNative.BIO_new_file(file, "r"))));
 }
Ejemplo n.º 4
0
 public OpenSslCertificate(OpenSslBIO bio)
 {
     _x509 = OpenSslUtility.AssertNotNull(OpenSslNative.PEM_read_bio_X509(bio.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero));
 }
Ejemplo n.º 5
0
 public OpenSslConnection(OpenSslContext ctx)
 {
     _context = ctx;
     _ssl     = OpenSslUtility.AssertNotNull(OpenSslNative.SSL_new(_context.Handle));
 }
Ejemplo n.º 6
0
 public OpenSslContext(OpenSslProtocol protocol, bool server)
 {
     _ctx = OpenSslUtility.AssertNotNull(OpenSslNative.SSL_CTX_new(GetMethodFromProtocol(protocol, server)));
 }