Giter Site home page Giter Site logo

encrypt's Introduction

demo地址 展示直接使用非对称密钥加解密数据大体流程

算法: RSA ,Elgamal,ECC

RSA的两种方式:

  1. 直接使用非对称密钥加解密数据

安全性低,复杂度低

密钥越长,加解密越耗时

能加密的明文长度有限制,密钥长度是2048bit的最多能加密245字节

一般都是用户自己保存私钥来解密,所以用公钥加密

  1. 用对称密钥(比如AES/DES等加解密方法)加解密数据,然后使用非对称密钥(RSA加解密密钥)加解密 对称密钥

安全性高,复杂度高,不存在加密数据长度限制问题

              客 户 端                                    服 务 端

                  +                                            +
                  |                                            |
    1. 生 成 随 机 的 对 称 加 密 密 钥                                     
                  |                                            |
                  |                                            |
    2. 对 称 加 密 数 据 |                                            
                  |                                            |
                  |                                            |
    3. 非 对 称 加 密 对 称 密 钥                                       
                  |                                            |
                  |                                            |
                  |  4.保 存 数 据 和 加 密 后 的 对 称 密 钥               
                  | +----------------------------------------> |
                  | <------------------------------------------+
                  |                                            |
    5.解 密 对 称 密 钥 ,用 对 称 密 钥 解 密 数 据                             
                  |                                            |
                  |                                            |
                  |                                            |
              

如果数据是第三方平台加密好的,我们只读,能否解密,还要考虑对方用加密方式和使用的库

如果加解密都是自己的系统做,推荐RSA方式2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.