# Return to Answer

4 Addressing CBHacking's comments

Trying to generalize it like you have done gets messy really fast because there are many asymmetric (or "public key") cryptographic algorithms (paraphrased from wikipedia):

Examples of well-regarded asymmetric key encryption and key exchange techniques for varied purposes include:

• Diffie–Hellman key exchange protocol
• DSS (Digital Signature Standard), which incorporates the Digital Signature Algorithm
• ElGamal encryption algorithm
• Various ellipticElliptic curve techniquesDiffie-Hellman key exchange
• Various password-authenticated key agreement techniques
• Paillier cryptosystem
• RSA encryption algorithm (PKCS#1)
• Cramer–Shoup cryptosystem
• YAK authenticated key agreement protocol

Examples of asymmetric key algorithms not widely adopted include:

• NTRUEncrypt cryptosystem
• McEliece cryptosystem

Examples of notable – yet insecure – asymmetric key algorithms include:

• Merkle–Hellman knapsack cryptosystem

You'll notice that RSA isand ElGamal are the only algorithmalgorithms that appears on both lists, ie the same algorithm can be used for both encryption and signatures. I'm personally not familiar with the math behind ElGamal, but RSA signatures work, the way you describe - that a hash of the message which can be decrypted by the public key, but. However that description does not fit any of the other signature algorithmswork in the listgeneral for all crypto algorithms, for example DSA which is for signatures and does not have an encryption variant.

That's the most specific you can get and know thatstill have it apply to all encryption and signature schemes because the details of how thisthe math works varies wildly from one algorithm to the next.

Trying to generalize it like you have done gets messy really fast because there are many asymmetric (or "public key") cryptographic algorithms (from wikipedia):

Examples of well-regarded asymmetric key techniques for varied purposes include:

• Diffie–Hellman key exchange protocol
• DSS (Digital Signature Standard), which incorporates the Digital Signature Algorithm
• ElGamal
• Various elliptic curve techniques
• Various password-authenticated key agreement techniques
• Paillier cryptosystem
• RSA encryption algorithm (PKCS#1)
• Cramer–Shoup cryptosystem
• YAK authenticated key agreement protocol

Examples of asymmetric key algorithms not widely adopted include:

• NTRUEncrypt cryptosystem
• McEliece cryptosystem

Examples of notable – yet insecure – asymmetric key algorithms include:

• Merkle–Hellman knapsack cryptosystem

You'll notice that RSA is the only algorithm that appears on both lists, ie the same algorithm can be used for both encryption and signatures. RSA signatures work, the way you describe - that a hash of the message which can be decrypted by the public key, but that description does not fit any of the other signature algorithms in the list.

and know that the details of how this works varies wildly from one algorithm to the next.

Trying to generalize it like you have done gets messy really fast because there are many asymmetric (or "public key") cryptographic algorithms (paraphrased from wikipedia):

Examples of well-regarded asymmetric key encryption and key exchange techniques for varied purposes include:

• Diffie–Hellman key exchange protocol
• ElGamal encryption algorithm
• Elliptic curve Diffie-Hellman key exchange
• Various password-authenticated key agreement techniques
• Paillier cryptosystem
• RSA encryption algorithm (PKCS#1)
• Cramer–Shoup cryptosystem
• YAK authenticated key agreement protocol

Examples of asymmetric key algorithms not widely adopted include:

• NTRUEncrypt cryptosystem
• McEliece cryptosystem

Examples of notable – yet insecure – asymmetric key algorithms include:

• Merkle–Hellman knapsack cryptosystem

You'll notice that RSA and ElGamal are the only algorithms that appears on both lists, ie the same algorithm can be used for both encryption and signatures. I'm personally not familiar with the math behind ElGamal, but RSA signatures work the way you describe - that a hash of the message which can be decrypted by the public key. However that description does not work in general for all crypto algorithms, for example DSA which is for signatures and does not have an encryption variant.

That's the most specific you can get and still have it apply to all encryption and signature schemes because the details of how the math works varies wildly from one algorithm to the next.

3 added 166 characters in body

Some digital signature algorithms - RSA-based signature schemes, such as RSA-PSS - DSA and its elliptic curve variant ECDSA - Edwards-curve Digital Signature Algorithm and its Ed25519 variant. - ElGamal signature scheme as the predecessor to DSA, and variants Schnorr signature and Pointcheval–Stern signature algorithm - Rabin signature algorithm - Pairing-based schemes such as BLS - Undeniable signatures

• RSA-based signature schemes, such as RSA-PSS
• DSA and its elliptic curve variant ECDSA
• Edwards-curve Digital Signature Algorithm and its Ed25519 variant.
• ElGamal signature scheme as the predecessor to DSA, and variants Schnorr signature and Pointcheval–Stern signature algorithm
• Rabin signature algorithm
• Pairing-based schemes such as BLS
• Undeniable signatures

You'll notice that RSA is the only algorithm that appears on both lists, ie the same algorithm can be used for both encryption and signatures. RSA signatures work, the way you describe - that a hash of the message which can be decrypted by the public key, but that description does not fit any of the other signature algorithms in the list.

What you state in your question is (mostly, slightly simplified) true for RSA, but certainly is not true for any other asymmetric encryption or digital signature algorithm. It's better to think of them as four separate cases:

• Encryption public key encrypts
• Encryption private key decrypts
• Signature private key signs
• Signature public key verifies

and know that the details of how this works varies wildly from one algorithm to the next.

Some digital signature algorithms - RSA-based signature schemes, such as RSA-PSS - DSA and its elliptic curve variant ECDSA - Edwards-curve Digital Signature Algorithm and its Ed25519 variant. - ElGamal signature scheme as the predecessor to DSA, and variants Schnorr signature and Pointcheval–Stern signature algorithm - Rabin signature algorithm - Pairing-based schemes such as BLS - Undeniable signatures

You'll notice that RSA is the only algorithm that appears on both lists, ie the same algorithm can be used for both encryption and signatures.

What you state in your question is (mostly, slightly simplified) true for RSA, but certainly is not true for any other asymmetric encryption or digital signature algorithm.

Some digital signature algorithms

• RSA-based signature schemes, such as RSA-PSS
• DSA and its elliptic curve variant ECDSA
• Edwards-curve Digital Signature Algorithm and its Ed25519 variant.
• ElGamal signature scheme as the predecessor to DSA, and variants Schnorr signature and Pointcheval–Stern signature algorithm
• Rabin signature algorithm
• Pairing-based schemes such as BLS
• Undeniable signatures

You'll notice that RSA is the only algorithm that appears on both lists, ie the same algorithm can be used for both encryption and signatures. RSA signatures work, the way you describe - that a hash of the message which can be decrypted by the public key, but that description does not fit any of the other signature algorithms in the list.

What you state in your question is (mostly, slightly simplified) true for RSA, but certainly is not true for any other asymmetric encryption or digital signature algorithm. It's better to think of them as four separate cases:

• Encryption public key encrypts
• Encryption private key decrypts
• Signature private key signs
• Signature public key verifies

and know that the details of how this works varies wildly from one algorithm to the next.

2 added 166 characters in body

I think you are mixing terms. Untangling them might help your understanding. (In the order you used them):

Key Exchange is one of a number of methods for taking a symmetric key that you have (see wikipedia/key_exchangesay an AES key) is defined as:and exchanging it with another party such that no eavesdroppers can learn it in the process.

any method in cryptography by which cryptographic keys are exchanged between two parties, allowing use of a cryptographic algorithm.

which may or may not have anything to do with asymetric encryption. (ie keyKey exchange and encryption are (almost) unrelated concepts.) Key exchange is often accomplished by using asymmetric encryption, but there are key exchange methods that have nothing to do with encryption.

Public key / private key encryption and digital signatures: you are correct in that with encryption, you encrypt for the recipient's public key and then they can decrypt with their private key. With signatures you sign with your private key and then anyone can verify with your public key.

# Are public keys and private keys interchangeable?

Trying to generalize it like you have done gets messy really fast because there are many asymmetric (or "public key") cryptographic algorithms (from wikipedia):

Examples of well-regarded asymmetric key techniques for varied purposes include:

• Diffie–Hellman key exchange protocol
• DSS (Digital Signature Standard), which incorporates the Digital Signature Algorithm
• ElGamal
• Various elliptic curve techniques
• Various password-authenticated key agreement techniques
• Paillier cryptosystem
• RSA encryption algorithm (PKCS#1)
• Cramer–Shoup cryptosystem
• YAK authenticated key agreement protocol

Examples of asymmetric key algorithms not widely adopted include:

• NTRUEncrypt cryptosystem
• McEliece cryptosystem

Examples of notable – yet insecure – asymmetric key algorithms include:

• Merkle–Hellman knapsack cryptosystem

There is a similar, but different, list of digital signature algorithms (also from wikipedia):

Some digital signature algorithms - RSA-based signature schemes, such as RSA-PSS - DSA and its elliptic curve variant ECDSA - Edwards-curve Digital Signature Algorithm and its Ed25519 variant. - ElGamal signature scheme as the predecessor to DSA, and variants Schnorr signature and Pointcheval–Stern signature algorithm - Rabin signature algorithm - Pairing-based schemes such as BLS - Undeniable signatures

You'll notice that RSA is the only algorithm that appears on both lists, ie the same algorithm can be used for both encryption and signatures.

# Summary

To answer your question "Should I think of asymmetric keys along the lines of one key encrypts and the other decrypts or can either in a pair be used to encrypt or decrypt?", the answer is "It depends which algorithm you are talking about."

What you state in your question is (mostly, slightly simplified) true for RSA, but certainly is not true for any other asymmetric encryption or digital signature algorithm.

I think you are mixing terms. Untangling them might help your understanding. (In the order you used them):

Key Exchange (see wikipedia/key_exchange) is defined as:

any method in cryptography by which cryptographic keys are exchanged between two parties, allowing use of a cryptographic algorithm.

which may or may not have anything to do with asymetric encryption. (ie key exchange and encryption are (almost) unrelated concepts.)

Public key / private key: you are correct in that with encryption, you encrypt for the recipient's public key and then they can decrypt with their private key. With signatures you sign with your private key and then anyone can verify with your public key.

Trying to generalize it like you have done gets messy really fast because there are many asymmetric (or "public key") cryptographic algorithms (from wikipedia):

Examples of well-regarded asymmetric key techniques for varied purposes include:

• Diffie–Hellman key exchange protocol
• DSS (Digital Signature Standard), which incorporates the Digital Signature Algorithm
• ElGamal
• Various elliptic curve techniques
• Various password-authenticated key agreement techniques
• Paillier cryptosystem
• RSA encryption algorithm (PKCS#1)
• Cramer–Shoup cryptosystem
• YAK authenticated key agreement protocol

Examples of asymmetric key algorithms not widely adopted include:

• NTRUEncrypt cryptosystem
• McEliece cryptosystem

Examples of notable – yet insecure – asymmetric key algorithms include:

• Merkle–Hellman knapsack cryptosystem

There is a similar, but different, list of digital signature algorithms (also from wikipedia):

Some digital signature algorithms - RSA-based signature schemes, such as RSA-PSS - DSA and its elliptic curve variant ECDSA - Edwards-curve Digital Signature Algorithm and its Ed25519 variant. - ElGamal signature scheme as the predecessor to DSA, and variants Schnorr signature and Pointcheval–Stern signature algorithm - Rabin signature algorithm - Pairing-based schemes such as BLS - Undeniable signatures

You'll notice that RSA is the only algorithm that appears on both lists, ie the same algorithm can be used for both encryption and signatures.

# Summary

To answer your question "Should I think of asymmetric keys along the lines of one key encrypts and the other decrypts or can either in a pair be used to encrypt or decrypt?", the answer is "It depends which algorithm you are talking about."

What you state in your question is (mostly, slightly simplified) true for RSA, but certainly is not true for any other asymmetric encryption or digital signature algorithm.

I think you are mixing terms. Untangling them might help your understanding. (In the order you used them):

Key Exchange is one of a number of methods for taking a symmetric key that you have (say an AES key) and exchanging it with another party such that no eavesdroppers can learn it in the process.

Key exchange and encryption are (almost) unrelated concepts. Key exchange is often accomplished by using asymmetric encryption, but there are key exchange methods that have nothing to do with encryption.

Public key / private key encryption and digital signatures: you are correct in that with encryption, you encrypt for the recipient's public key and then they can decrypt with their private key. With signatures you sign with your private key and then anyone can verify with your public key.

# Are public keys and private keys interchangeable?

Trying to generalize it like you have done gets messy really fast because there are many asymmetric (or "public key") cryptographic algorithms (from wikipedia):

Examples of well-regarded asymmetric key techniques for varied purposes include:

• Diffie–Hellman key exchange protocol
• DSS (Digital Signature Standard), which incorporates the Digital Signature Algorithm
• ElGamal
• Various elliptic curve techniques
• Various password-authenticated key agreement techniques
• Paillier cryptosystem
• RSA encryption algorithm (PKCS#1)
• Cramer–Shoup cryptosystem
• YAK authenticated key agreement protocol

Examples of asymmetric key algorithms not widely adopted include:

• NTRUEncrypt cryptosystem
• McEliece cryptosystem

Examples of notable – yet insecure – asymmetric key algorithms include:

• Merkle–Hellman knapsack cryptosystem

There is a similar, but different, list of digital signature algorithms (also from wikipedia):

Some digital signature algorithms - RSA-based signature schemes, such as RSA-PSS - DSA and its elliptic curve variant ECDSA - Edwards-curve Digital Signature Algorithm and its Ed25519 variant. - ElGamal signature scheme as the predecessor to DSA, and variants Schnorr signature and Pointcheval–Stern signature algorithm - Rabin signature algorithm - Pairing-based schemes such as BLS - Undeniable signatures

You'll notice that RSA is the only algorithm that appears on both lists, ie the same algorithm can be used for both encryption and signatures.

# Summary

To answer your question "Should I think of asymmetric keys along the lines of one key encrypts and the other decrypts or can either in a pair be used to encrypt or decrypt?", the answer is "It depends which algorithm you are talking about."

What you state in your question is (mostly, slightly simplified) true for RSA, but certainly is not true for any other asymmetric encryption or digital signature algorithm.

1