Make HTTP transmissions more secure, encrypted communication for C/S B/S architecture.
Project description
通过使用RSA+AES让HTTP传输更加安全,即C/S架构的加密通信!(Make HTTP transmissions more secure via RSA+AES, encrypted communication for C/S architecture.)
使用概述(Overview)
安装(Installation):
# 正式版(Release)
$ pip install -U PySecureHTTP
# 开发版(Dev)
$ pip install -U git+git+https://github.com/cisco08/PythonWeb-SecureHTTP@master
示例代码(Examples):
AES加密、解密
from SecureHTTP import AESEncrypt, AESDecrypt # 加密后的密文 ciphertext = AESEncrypt('ThisIsASecretKey', 'Hello World!') # 解密后的明文 plaintext = AESDecrypt("ThisIsASecretKey", ciphertext)RSA加密、解密
from SecureHTTP import RSAEncrypt, RSADecrypt, generate_rsa_keys # 生成密钥对 (pubkey, privkey) = generate_rsa_keys(incall=True) # 加密后的密文 ciphertext = RSAEncrypt(pubkey, 'Hello World!') # 解密后的明文 plaintext = RSADecrypt(privkey, ciphertext)C/S加解密示例:
# 模拟C/S请求 from SecureHTTP import EncryptedCommunicationClient, EncryptedCommunicationServer, generate_rsa_keys post = {u'a': 1, u'c': 3, u'b': 2, u'data': ["a", 1, None]} resp = {u'msg': None, u'code': 0} # 生成密钥对 (pubkey, privkey) = generate_rsa_keys(incall=True) # 初始化客户端类 client = EncryptedCommunicationClient(pubkey) # 初始化服务端类 server = EncryptedCommunicationServer(privkey) # NO.1 客户端加密数据 c1 = client.clientEncrypt(post) # NO.2 服务端解密数据 s1 = server.serverDecrypt(c1) # NO.3 服务端返回加密数据 s2 = server.serverEncrypt(resp) # NO.4 客户端获取返回数据并解密 c2 = client.clientDecrypt(s2) # 以上四个步骤即完成一次请求/响应
说在后面(END)
欢迎提交PR、共同开发!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PySecureHTTP-1.0.1.tar.gz
(10.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file PySecureHTTP-1.0.1.tar.gz.
File metadata
- Download URL: PySecureHTTP-1.0.1.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86f073bd7b228740936895937d44a68e6eb6d96cdfdddfe9e5bc7e172a2d8dbb
|
|
| MD5 |
58a50922d7f9bbbd2b4daab4231c64b3
|
|
| BLAKE2b-256 |
a87595ec0288acec0646189fab38b65722b0dd59d1fe2464233d7fb5e3ee7c9b
|
File details
Details for the file PySecureHTTP-1.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: PySecureHTTP-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a193a21b57105129713923e528ee571867a78293aeaf271a5dca08340482c4d
|
|
| MD5 |
2cdffd7cdaa6ce8bf2c7c50e541141cc
|
|
| BLAKE2b-256 |
6fa318ab8cd20c3c26f6b4794f76347ecfcd67c2cada14736beb4c91a0351518
|