Exemplo n.º 1
0
        public SslStreamServer(
            Stream stream,
            bool ownStream,
            string pskCiphers,
            byte[] pskPsk)
            : base(stream, ownStream)
        {
            this.pskCiphers = pskCiphers;
            this.pskPsk = pskPsk;

            this.internalPskServerCallback = new PskServerCallbackHandler(InternalPskServerCallback);

            // Initialize the SslContext object
            InitializeServerContextUsingPsk(this.pskCiphers);

            // Initalize the Ssl object
            ssl = new Ssl(sslContext);
            // Initialze the read/write bio
            read_bio = BIO.MemoryBuffer(false);
            write_bio = BIO.MemoryBuffer(false);
            // Set the read/write bio's into the the Ssl object
            ssl.SetBIO(read_bio, write_bio);
            read_bio.SetClose(BIO.CloseOption.Close);
            write_bio.SetClose(BIO.CloseOption.Close);
            // Set the Ssl object into server mode
            ssl.SetAcceptState();
        }
Exemplo n.º 2
0
        public SslStreamServer(
            Stream stream,
            bool ownStream,
            string pskCiphers,
            byte[] pskPsk)
            : base(stream, ownStream)
        {
            this.pskCiphers = pskCiphers;
            this.pskPsk     = pskPsk;

            this.internalPskServerCallback = new PskServerCallbackHandler(InternalPskServerCallback);

            // Initialize the SslContext object
            InitializeServerContextUsingPsk(this.pskCiphers);

            // Initalize the Ssl object
            ssl = new Ssl(sslContext);
            // Initialze the read/write bio
            read_bio  = BIO.MemoryBuffer(false);
            write_bio = BIO.MemoryBuffer(false);
            // Set the read/write bio's into the the Ssl object
            ssl.SetBIO(read_bio, write_bio);
            read_bio.SetClose(BIO.CloseOption.Close);
            write_bio.SetClose(BIO.CloseOption.Close);
            // Set the Ssl object into server mode
            ssl.SetAcceptState();
        }
Exemplo n.º 3
0
 public void SetPskServerCallback(PskServerCallbackHandler callback)
 {
     _pskServerCallbackThunk = new PskServerCallbackThunk(callback);
     Native.SSL_CTX_set_psk_server_callback(this.ptr, _pskServerCallbackThunk.Callback);
 }
Exemplo n.º 4
0
 public PskServerCallbackThunk(PskServerCallbackHandler callback)
 {
     this.OnPskServerCallback = callback;
 }
Exemplo n.º 5
0
 public void SetPskServerCallback(PskServerCallbackHandler callback)
 {
     _pskServerCallbackThunk = new PskServerCallbackThunk(callback);
     Native.SSL_CTX_set_psk_server_callback(this.ptr, _pskServerCallbackThunk.Callback);
 }
Exemplo n.º 6
0
 public PskServerCallbackThunk(PskServerCallbackHandler callback)
 {
     this.OnPskServerCallback = callback;
 }