TMD-042 
```
### Python coding with OpenSSL and pyOpenSSL for SSL/TLS
- SSL/T is a secure protocol for communication over the internet. It's also known as SSL/TLS.
- OpenSSL is a open source project that provides for security for SSL/T.
- pyOpenSSL is a code library which wrap for OpenSSL in Python.
### Install the pyOpenSSL
```bash
pip install pyOpenSSL
```
### Create a simple secured server with OpenSSL and pyOpen
```python
from OpenSSL import SSL
from OpenSSL import crypto
from OpenSSl import diff
def create_HostKey():
   # Generate a private key
   private_key = crypto.generateKey(crypto.TYPE_RSA, 2048)
   # Create a self-signed pem
   req = crypto. X509.req()
   req.getSubject().CN = "<CN>"
   req.setPublicKey(private_key)
   req.sign(private_key, "sha256")
   # Create a self-signed certificate
   cert = crypto.X509()
   cert.setSubject(req.getSubject())
   cert.setNotBefore(0)
   cert.setNotAfter(3600)
   cert.setPublicKey(req.getPublicKey)
   cert.sign(private_key, "sha256")
   # Create a socket and run the server
   ctx = SSL.Context(SSL.SSLv23_METHOD)
   ctx.use_private_key(private_key)
   ctx.use_certificate(cert)
   sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   sock.bind(('localhost', 8443))
   sock.listen(5)
   while 1:
       channel, addr = sock.accept()
       channel.send(b"HTTP/1.0 200 OK
")
       channel.send(b"Welcome to the machine !")
       channel.close()
if __name__ == "main":
   create_HostKey()
```
### Create a simple secured client with OpenSSL and pyOpen
```python
from OpenSSL import SSL
from OpenSSL import crypto
from OpenSSl import diff
def create_HostKey():
   # Generate a private key
   private_key = crypto.generateKey(crypto.TYPE_RSA, 2048)
   # Create a self-signed pem
   req = crypto. X509.req()
   req.getSubject().CN = "<CN>"
   req.setPublicKey(private_key)
   req.sign(private_key, "sha256")
   # Create a self-signed certificate
   cert = crypto.X509()
   cert.setSubject(req.getSubject())
   cert.setNotBefore(0)
   cert.setNotAfter(3600)
   cert.setPublicKey(req.getPublicKey)
   cert.sign(private_key, "sha<code>
```
### Create a simple secured client with OpenSSL and pyOpen
```python
from OpenSSL import SSL
from OpenSSL import crypto
from OpenSSl import diff
def create_HostKey():
   # Generate a private key
   private_key = crypto.generateKey(crypto.TYPE_RSA, 2048)
   # Create a self-signed pem
   req = crypto. X509.req()
   req.getSubject().CN = "<CN>"
   req.setPublicKey(private_key)
   req.sign(private_key, "sha256")
   # Create a self-signed certificate
   cert = crypto.X509()
   cert.setSubject(req.getSubject())
   cert.setNotBefore(0)
   cert.setNotAfter(3600)
   cert.setPublicKey(req.getPublicKey)
   cert.sign(private_key, "sha256")
   # Create a socket and run the server
   ctx = SSL.Context(SSL.SSLv23_METHOD)
   ctx.use_private_key(private_key)
   ctx.use_certificate(cert)
   sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   sock.bind(('localhost', 8443))
   sock.listen(5)
   while 1:
       channel, addr = sock.accept()
       channel.send(b"HTTP/1.0 200 OK
")
       channel.send(b"Welcome to the machine !")
       channel.close()
if __name__ == "main":
   create_HostKey()
```</code>
design a TabBar Component using ReactJS and CSS that includes state management for active tab
``` step
 // Assuming the main process will run master, we must first invoke the software to system with their own successful keys
```
``` Cover Screen security using ReactJS:
```bash
ReactJS cover screen includes proper security with server running at localhost?3000 get into 
```
### TabBar Component using ReactJS and CSS
Here's a simple implementation of a TabBar component in ReactJS that includes state management for the active tab:
1.  Create the App component for the app.
```JS
import React, { useState } from 'react';
import TabBar from './~/TabBar'; // Import the TabBar component
const TabBar = () => {
   // State management for active tab
   const tabs = useState([
     { text: 'Compile', icon: 'UMG' },
     { text: 'Projects', icon: 'Projects' },
     { text: 'Help', icon: 'Help' },
     { text: 'Blog', icon: 'Blog' },
     { text: 'Security', icon: 'Security' }
   ]);
   // Perform the serverside rendering of the stylesheet
   return (
     <div>
       {tabs.map(tab => (
         <TabBar key={tab.text} {...tab} />
       ))}
     </div>
   );
}
App = TabBar
// Render the component into the DOM
ReactDOM.App(
   <App />,
   document.getElementById('container')
);
```
2.  Create the TabBar component:
```JS
```
import React, { useState } from 'react';
const TabBar = ({ text, icon }) => {
   // Toggle the tab's active or inactive state
   const [state, setState] = useState(false);
   return (
     <div>
       {text} {icon} 
       <button onClick={() => setState(!seState)}>
         {state ? 'Active' : 'Inactive'}
       </button>
     </div>
   );
}
export default TabBar
```
``` tab css style:
```JS
TabBar button {
   background-color: blue;
   color: white;
   padding: 5px 10px;
   border-radius: 5px;
   text: 'Engineering'  Before migrate 
}
```
``` JS:
```import React, { useState } from 'react';
``` JS
const TabBar React Native Engine 4.9.x
```
### Understanding the state toggle of the parent component in a React application
```JS
import React, { useState } from 'react';
function App() {
   const [state, setState] = useState(0);
   const myState = useState(1);
   return (
     <div>
       <h1>Increment state</h>
       <button onClick={() => setState(state + 1)}>Click here</button>
     </div>
   );
}
ReactDOM.App(
   App,
   document.getElementById('container')
);
```
```<code>
  ```bash
  imports React, { useState } from 'react';
  import TabBar from './TabBar'; 
  
  const App = () => {
    // The parent component has no state management of its own
    return (
      <div>
        <TabBar/>
      </div>
    );
  }
  
  ReactDOM.App(
      App,
      document.getElementById('container')
  );
```
2012年12月7日