公钥加密如何工作? [英] How does public key encryption work?

查看:78
本文介绍了公钥加密如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用私钥和公用/公用密钥解密/加密,公用密钥加密如何工作?密钥为256位意味着什么?如何解密?有写加密程序的语言吗?或者任何语言都可以?

How does public key encryption work, using a private and public/public key to decrypt/encrypt? What does it mean for the key to be 256 bits? How is it decrypted? Is there a language for writing encryption programs or is any language fine?

推荐答案

简而言之:

使用对称算法和随机对称密钥对数据进行加密.然后,使用公共非对称密钥对随机密钥进行加密.加密的随机密钥与加密的数据一起存储.要解密数据,请使用非对称私钥对存储的随机密钥进行解密,然后使用解密后的随机密钥对数据进行解密.

the data is encrypted using symmetric algorithm and a random symmetric key. Then the random key is encrypted using public asymmetric key. The encrypted random key is stored together with the encrypted data. To decrypt the data one uses private asymmetric key to decrypt the stored random key, then the decrypted random key is used to decrypt the data.

256位是密钥的长度.但是,对于对称密钥和非对称密钥,它具有截然不同的含义.对于对称密钥,256位是非常强的密钥(您可以使用AES 384或AES 512拥有更长的密钥,其中数字指定算法使用的密钥长度).对于非对称算法,256位为零,可比较的强度为2048位.

256-bit is the length of the key. However, it has dramatically different meaning for symmetric and asymmetric keys. For symmetric keys 256 bits are a very strong key (you can have even longer keys with AES 384 or AES 512 where the numbers specify the key length the algorithm operates with). For asymmetric algorithms 256 bits is nothing, and comparable strength is 2048 bits.

公钥加密可以使用任何支持数学运算和数组的语言来实现.但是,这样做是在重新发明轮子.对于PKI,存在许多跨平台库:针对C ++的开源 OpenSSL SecureBlackbox 产品.很快).

Public key encryption can be implemented using any language, that supports math operations and arrays. However, doing this is reinventing the wheels. There exists a number of cross-platform libraries for PKI: open-source OpenSSL for C++, BouncyCastle for Java and some more. Our company offers a supported and maintained SecureBlackbox product for .NET, Windows and Linux (MacOS X version to come soon).

还有几本关于PKI的书我们向所有用户推荐.RSA的指南很容易阅读(但非常有用),第二本书更深入地介绍了该指南.

Also there's a couple of books about PKI that we recommend to all our users. RSA's guide is an easy reading (but very useful) and the second book goes into deeper details.

这篇关于公钥加密如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆