我们提供融合门户系统招投标所需全套资料,包括融合系统介绍PPT、融合门户系统产品解决方案、
融合门户系统产品技术参数,以及对应的标书参考文件,详请联系客服。
import ssl
import http.server
import socketserver
PORT = 8443
DIRECTORY = "public"
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=DIRECTORY, **kwargs)
# 加载证书和私钥
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(certfile="server.crt", keyfile="server.key")
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print(f"Serving at port {PORT}")
httpd.socket = context.wrap_socket(httpd.socket, server_side=True)
httpd.serve_forever()
]]>
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
def encrypt_data(data, key):
cipher = AES.new(key, AES.MODE_EAX)
ciphertext, tag = cipher.encrypt_and_digest(data)
return (ciphertext, cipher.nonce, tag)
key = get_random_bytes(16) # 密钥必须是16字节长度
data = b"Sensitive data"
encrypted_data = encrypt_data(data, key)
print("Encrypted:", encrypted_data)
]]>