Skip to main content

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)

# 正式版(Release)
$ pip install -U SecureHTTP
# 开发版(Dev)
$ pip install -U git+https://github.com/staugur/Python-SecureHTTP.git@master

示例代码(Examples)

  1. RSA加密、解密

    from SecureHTTP import AESEncrypt, AESDecrypt
    # 加密后的密文
    ciphertext = AESEncrypt('ThisIsASecretKey', 'Hello World!')
    # 解密后的明文
    plaintext = AESDecrypt("ThisIsASecretKey", ciphertext)
  2. 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)
  3. 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)
    # 以上四个步骤即完成一次请求/响应
  4. B/S加解密示例: 前端使用AES+RSA加密,后端解密

文档(Documentation)

中文(Chinese)

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.4.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

SecureHTTP-0.4.1-py2.py3-none-any.whl (10.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file SecureHTTP-0.4.1.tar.gz.

File metadata

  • Download URL: SecureHTTP-0.4.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/41.0.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.12

File hashes

Hashes for SecureHTTP-0.4.1.tar.gz
Algorithm Hash digest
SHA256 84e32c74ccdade60d1ec8832a8ba5718c80aa69d9b6f014897065d27a2d741fb
MD5 dc580dd286c595f5948fff811a0ccc82
BLAKE2b-256 c67ff28aecc32b5f3c69913899a9944871fea296b0e80356555ebcea81062b40

See more details on using hashes here.

File details

Details for the file SecureHTTP-0.4.1-py2.py3-none-any.whl.

File metadata

  • Download URL: SecureHTTP-0.4.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/41.0.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.12

File hashes

Hashes for SecureHTTP-0.4.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ecaff7d7e28f05bb72955c8fda845d77d17d2d9740c9fb300b14fec486624f18
MD5 3d7b5250e91bede9bea757679aa93d23
BLAKE2b-256 f6b4038e6712f7f47f31c948b75584875b9bdc33386889c7f1f386c7429c77b1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page