In AES encryption (.net framework), how are the public and private keys used?
在AES加密(.net框架)中,公钥和私钥是如何使用的?
Are the public and private keys combined to form a full key, and then the algorithm uses the public + private key to encrypt the data?
公钥和私钥是否组合在一起形成一个完整的密钥,然后算法使用公钥+私钥来加密数据?
(simplified keys used below for example purposes)
(以下用于示例目的的简化密钥)
e.g. public key = 12345 private key = 67890
例如公钥= 12345私钥= 67890
so the key used when generating the encryption result is: 1234567890
所以生成加密结果时使用的密钥是:1234567890
5 个解决方案
#1
84
As others have said, AES is a symmetric algorithm (private-key cryptography). This involves a single key which is a shared secret between the sender and recipient. An analogy is a locked mailbox without a mail slot. Anybody who wants to leave or read a message needs to have a key to the mailbox.
正如其他人所说,AES是一种对称算法(私钥加密)。这涉及单个密钥,它是发送方和接收方之间的共享密钥。类比是没有邮件槽的锁定邮箱。任何想要离开或阅读邮件的人都需要拥有邮箱的密钥。
If you really want to know the gory details of AES, there's a superb cartoon to guide you along the way.
如果您真的想知道AES的血腥细节,那么有一款精湛的卡通可以指导您。
Public-key cryptography involves two related keys for each recipient involved - a private key which is a secret known only by the recipient, and a related public key which is known by all senders.
公钥加密涉及每个接收者所涉及的两个相关密钥 - 私钥是仅由接收者知道的秘密,以及所有发送者都知道的相关公钥。
The sender encrypts the message using the recipient's public key. That message can only be decrypted by a recipient with a private key matching the public key.
发件人使用收件人的公钥加密邮件。该消息只能由具有与公钥匹配的私钥的收件人解密。
An analogy for public-key encryption is a locked mailbox with a mail slot. The mail slot is exposed and accessible to the public. Its location (the street address) is the public key. Anyone knowing the street address can go to the door and drop a written message through the slot. But only the person who possesses the private key can open the mailbox and read the message.
公钥加密的类比是带有邮件槽的锁定邮箱。邮件插槽是公开的,可供公众访问。它的位置(街道地址)是公钥。任何知道街道地址的人都可以上门并通过插槽发送书面信息。但只有拥有私钥的人才能打开邮箱并阅读邮件。
#2
22
AES is a symmetric algorithm, so it does not have public and private keys - only a shared secret.
AES是一种对称算法,因此它没有公钥和私钥 - 只有共享密钥。
#3
3
A public key is linked to a private key. The public key (RSA) is distributed to the 'wild' and anyone who wants to send an encrypted file (generically speaking here), they will request the public key and encode against it. The cypertext is unreadable to anyone who gains access to the file, even if they have the public key.
公钥链接到私钥。公钥(RSA)分发给'wild'和任何想要发送加密文件的人(一般来说这里),他们将请求公钥并对其进行编码。即使拥有公钥,任何获得该文件访问权限的人都无法读取该cypertext。
The private key is needed to decode the file. As long as the private key is kept private, it is statically improbable that anyone will guess or hack the the key. Improbable, not impossible.
解码文件需要私钥。只要私钥保密,那么任何人都会猜测或破解密钥是绝对不可能的。不太可能,不是不可能的。
The real issue is keeping the private key private. Most cracks are done with social hacking. Extortion, loggers and monkey-in-the-middle public key conversion are other ways more probable than brute forcing the password or key.
真正的问题是保密私钥。大多数裂缝都是通过社交黑客来完成的。敲诈,记录器和猴子中间公钥转换是比强制密码或密钥更可能的其他方式。
In your comment to Brawndo you asked
在你对Brawndo的评论中你问过
what's the point of having a public and private key then if both can decrypt others? Why not both have the same key?
如果两者都可以解密其他人,那么拥有公钥和私钥的重点是什么?为什么两个都没有相同的密钥?
What you are describing is Symmetric-key algorithms, which AES is one. The reason for public-private keys are that with Symmetric-key algorithms how do you pass a Symmetric key over unsecured networks, mail, phone or what not without the key being intercepted. Perhaps encrypting the key, but then how do you pass that key? With a public-private key combo, that becomes LESS relevant.
您所描述的是对称密钥算法,AES就是其中之一。公钥 - 私钥的原因在于使用对称密钥算法如何通过不安全的网络,邮件,电话或者没有密钥被拦截的情况下传递对称密钥。也许加密密钥,但是你如何传递密钥?使用公钥 - 私钥组合,它变得无关紧要。
"In most cases, there's a greater probability that the sun will burn out before all the computers in the world could factor in all of the information needed to brute force a 256-bit key," said Jon Hansen, vice president of marketing for AccessData Corp, the Lindon, Utah, company that built the software that powers DNA.
“在大多数情况下,在世界上所有计算机都可以考虑暴力破解256位密钥所需的所有信息之前,太阳将被烧毁的可能性更大,”AccessData营销副总裁Jon Hansen说。公司,犹他州Lindon,公司建立了为DNA提供动力的软件。
#4
1
I do not know how the .net framework specifically works (the question should probably have been tagged .net) but by your question it sounds like it implements public/private key crypto, just using AES for its symmetric component.
我不知道.net框架是如何工作的(这个问题应该被标记为.net),但是通过你的问题,它听起来像是实现公钥/私钥密码,只是使用AES作为其对称组件。
The usual mode of doing public key encryption is to
通常的公钥加密模式是
- Generate a symmetric key
- Encrypt the data with this key, using a symmetric algorithm like AES.
- Encrypt the symmetric key with the public key, using a asymmetric algo like RSA.
- Bundle the encrypted sym key with the encrypted data
生成对称密钥
使用AES等对称算法使用此密钥加密数据。
使用RSA等非对称算法使用公钥加密对称密钥。
将加密的sym密钥与加密数据捆绑在一起
The reason symmetric algos are preferred for the data itself is that asymmetric ones are very slow.
对称算法对于数据本身是优选的原因是不对称算法非常慢。
Given that they couldn't test security (all they really had was the absense of breaks, for several og the candidates), the reason for choosing Rijndael for AES was (mostly) performance related.
鉴于他们无法测试安全性(他们真正拥有的只是缺席,对于几个候选人而言),选择Rijndael用于AES的原因(大部分)与性能相关。
#5
1
In the simplest form:
最简单的形式:
AES is a symetric algorithm, it uses the same key for encryption and decryption.So tat whoever has the key can read your message.
AES是一种对称算法,它使用相同的密钥进行加密和解密。因此,拥有密钥的任何人都可以阅读您的消息。
The private and public key is for Asymetric alogorithms like RSA, normally people use public key to encrypt and private key to decrypt( only HMAC or MAC will use private key to encrypt, and public key to decrypt).The public key is known to everyone, the private key is only known to yourself, so no one can read the message sent to you.
私有和公共密钥用于像RSA这样的非对称算法,通常人们使用公钥加密和私钥解密(只有HMAC或MAC将使用私钥加密,公钥才能解密)。每个人都知道公钥,私钥只有你自己知道,所以没有人可以阅读发送给你的消息。
#1
84
As others have said, AES is a symmetric algorithm (private-key cryptography). This involves a single key which is a shared secret between the sender and recipient. An analogy is a locked mailbox without a mail slot. Anybody who wants to leave or read a message needs to have a key to the mailbox.
正如其他人所说,AES是一种对称算法(私钥加密)。这涉及单个密钥,它是发送方和接收方之间的共享密钥。类比是没有邮件槽的锁定邮箱。任何想要离开或阅读邮件的人都需要拥有邮箱的密钥。
If you really want to know the gory details of AES, there's a superb cartoon to guide you along the way.
如果您真的想知道AES的血腥细节,那么有一款精湛的卡通可以指导您。
Public-key cryptography involves two related keys for each recipient involved - a private key which is a secret known only by the recipient, and a related public key which is known by all senders.
公钥加密涉及每个接收者所涉及的两个相关密钥 - 私钥是仅由接收者知道的秘密,以及所有发送者都知道的相关公钥。
The sender encrypts the message using the recipient's public key. That message can only be decrypted by a recipient with a private key matching the public key.
发件人使用收件人的公钥加密邮件。该消息只能由具有与公钥匹配的私钥的收件人解密。
An analogy for public-key encryption is a locked mailbox with a mail slot. The mail slot is exposed and accessible to the public. Its location (the street address) is the public key. Anyone knowing the street address can go to the door and drop a written message through the slot. But only the person who possesses the private key can open the mailbox and read the message.
公钥加密的类比是带有邮件槽的锁定邮箱。邮件插槽是公开的,可供公众访问。它的位置(街道地址)是公钥。任何知道街道地址的人都可以上门并通过插槽发送书面信息。但只有拥有私钥的人才能打开邮箱并阅读邮件。
#2
22
AES is a symmetric algorithm, so it does not have public and private keys - only a shared secret.
AES是一种对称算法,因此它没有公钥和私钥 - 只有共享密钥。
#3
3
A public key is linked to a private key. The public key (RSA) is distributed to the 'wild' and anyone who wants to send an encrypted file (generically speaking here), they will request the public key and encode against it. The cypertext is unreadable to anyone who gains access to the file, even if they have the public key.
公钥链接到私钥。公钥(RSA)分发给'wild'和任何想要发送加密文件的人(一般来说这里),他们将请求公钥并对其进行编码。即使拥有公钥,任何获得该文件访问权限的人都无法读取该cypertext。
The private key is needed to decode the file. As long as the private key is kept private, it is statically improbable that anyone will guess or hack the the key. Improbable, not impossible.
解码文件需要私钥。只要私钥保密,那么任何人都会猜测或破解密钥是绝对不可能的。不太可能,不是不可能的。
The real issue is keeping the private key private. Most cracks are done with social hacking. Extortion, loggers and monkey-in-the-middle public key conversion are other ways more probable than brute forcing the password or key.
真正的问题是保密私钥。大多数裂缝都是通过社交黑客来完成的。敲诈,记录器和猴子中间公钥转换是比强制密码或密钥更可能的其他方式。
In your comment to Brawndo you asked
在你对Brawndo的评论中你问过
what's the point of having a public and private key then if both can decrypt others? Why not both have the same key?
如果两者都可以解密其他人,那么拥有公钥和私钥的重点是什么?为什么两个都没有相同的密钥?
What you are describing is Symmetric-key algorithms, which AES is one. The reason for public-private keys are that with Symmetric-key algorithms how do you pass a Symmetric key over unsecured networks, mail, phone or what not without the key being intercepted. Perhaps encrypting the key, but then how do you pass that key? With a public-private key combo, that becomes LESS relevant.
您所描述的是对称密钥算法,AES就是其中之一。公钥 - 私钥的原因在于使用对称密钥算法如何通过不安全的网络,邮件,电话或者没有密钥被拦截的情况下传递对称密钥。也许加密密钥,但是你如何传递密钥?使用公钥 - 私钥组合,它变得无关紧要。
"In most cases, there's a greater probability that the sun will burn out before all the computers in the world could factor in all of the information needed to brute force a 256-bit key," said Jon Hansen, vice president of marketing for AccessData Corp, the Lindon, Utah, company that built the software that powers DNA.
“在大多数情况下,在世界上所有计算机都可以考虑暴力破解256位密钥所需的所有信息之前,太阳将被烧毁的可能性更大,”AccessData营销副总裁Jon Hansen说。公司,犹他州Lindon,公司建立了为DNA提供动力的软件。
#4
1
I do not know how the .net framework specifically works (the question should probably have been tagged .net) but by your question it sounds like it implements public/private key crypto, just using AES for its symmetric component.
我不知道.net框架是如何工作的(这个问题应该被标记为.net),但是通过你的问题,它听起来像是实现公钥/私钥密码,只是使用AES作为其对称组件。
The usual mode of doing public key encryption is to
通常的公钥加密模式是
- Generate a symmetric key
- Encrypt the data with this key, using a symmetric algorithm like AES.
- Encrypt the symmetric key with the public key, using a asymmetric algo like RSA.
- Bundle the encrypted sym key with the encrypted data
生成对称密钥
使用AES等对称算法使用此密钥加密数据。
使用RSA等非对称算法使用公钥加密对称密钥。
将加密的sym密钥与加密数据捆绑在一起
The reason symmetric algos are preferred for the data itself is that asymmetric ones are very slow.
对称算法对于数据本身是优选的原因是不对称算法非常慢。
Given that they couldn't test security (all they really had was the absense of breaks, for several og the candidates), the reason for choosing Rijndael for AES was (mostly) performance related.
鉴于他们无法测试安全性(他们真正拥有的只是缺席,对于几个候选人而言),选择Rijndael用于AES的原因(大部分)与性能相关。
#5
1
In the simplest form:
最简单的形式:
AES is a symetric algorithm, it uses the same key for encryption and decryption.So tat whoever has the key can read your message.
AES是一种对称算法,它使用相同的密钥进行加密和解密。因此,拥有密钥的任何人都可以阅读您的消息。
The private and public key is for Asymetric alogorithms like RSA, normally people use public key to encrypt and private key to decrypt( only HMAC or MAC will use private key to encrypt, and public key to decrypt).The public key is known to everyone, the private key is only known to yourself, so no one can read the message sent to you.
私有和公共密钥用于像RSA这样的非对称算法,通常人们使用公钥加密和私钥解密(只有HMAC或MAC将使用私钥加密,公钥才能解密)。每个人都知道公钥,私钥只有你自己知道,所以没有人可以阅读发送给你的消息。