Make HTTP transmissions more secure, encrypted communication for C/S architecture.
Project description
让HTTP传输更加安全,C/S架构的加密通信!(Make HTTP transmissions more secure, encrypted communication for C/S architecture.)
使用概述(Overview)
安装(Installation)
$ pip install -U SecureHTTP
示例代码(Examples)
RSA加密、解密
from SecureHTTP import AESEncrypt, AESDecrypt # 加密后的密文 ciphertext = AESEncrypt('ThisIsASecretKey', 'Hello World!') # 解密后的明文 plaintext = AESDecrypt("ThisIsASecretKey", ciphertext)
AES加密、解密
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加解密示例: 点此查看以下模拟代码的真实WEB环境示例
# 模拟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) # 以上四个步骤即完成一次请求/响应
B/S加解密示例: 登录时,password使用RSA加密,后端解密
文档(Documentation)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
SecureHTTP-0.3.0.tar.gz
(9.9 kB
view details)
Built Distribution
File details
Details for the file SecureHTTP-0.3.0.tar.gz
.
File metadata
- Download URL: SecureHTTP-0.3.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea26798439f5bf8112dc29b047dc392654e45ce386978cd3466f54e8c5f658ef |
|
MD5 | 7d774d403bd20188b45e8f0d764bc18e |
|
BLAKE2b-256 | d58c13fa95b6df384b703623216216314f5a6723e1637956fdf9c4d7b325117f |
File details
Details for the file SecureHTTP-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: SecureHTTP-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d30a50e53c34716866f13f77b623e0f7ad9e4381ba0ba0f63f7529afb2a9c46 |
|
MD5 | 7f30ff8a31d84eadffc9822b93dbdb93 |
|
BLAKE2b-256 | 1eef639212d936994c838254243483fa86004ce86eb70cf59e175edb03c27168 |