Asymmetric Encryption
Asymmetric Encryption
• The sender generates a pair of keys: a public key and a private key.
The public key is made available to anyone who wants it, but the
private key is kept secret by the sender.
• The sender encrypts the message using the recipient's public key. This
can be done by anyone who knows the recipient's public key, but only
the recipient can decrypt it using their private key.
• The sender sends the encrypted message to the recipient.
• The recipient uses their private key to decrypt the message. Only the
recipient can do this, because only they have the private key.
RSA
• RSA is a very secure encryption algorithm, but it is also relatively slow.
This is because RSA uses a lot of computation to encrypt and decrypt
data.
• RSA is often used in conjunction with other encryption algorithms to
provide a secure communication channel. For example,
• RSA can be used to encrypt the initial communication between two parties,
and then a symmetric encryption algorithm can be used to encrypt the
subsequent communication. This allows for a secure communication channel
that is both fast and secure
Advantages of RSA
• Security: RSA is considered to be very secure. This is because it is
based on the difficulty of factoring large numbers, which is a
computationally intensive problem.
• Versatility: RSA can be used for a variety of applications, including
data encryption, digital signatures, and key exchange.
• Standardization: RSA is widely standardized, which makes it easy to
implement and use.
Disadvantages of RSA
• RSA also has some disadvantages, which include:
• Key size: RSA keys are typically much larger than keys used for
symmetric cryptography. This can make RSA slower than symmetric
cryptography.
• Complexity: RSA is more complex to implement than symmetric
cryptography.
Applications of RSA
• RSA is used in a variety of applications, including:
• Data encryption: RSA is used to encrypt data that needs to be protected from
unauthorized access.
• Digital signatures: RSA is used to create digital signatures, which can be used
to verify the authenticity of documents and messages.
• Key exchange: RSA can be used to exchange keys securely over an insecure
channel.
RSA Encryption Implementation Example
RSA Encryption Implementation Example
RSA Decryption Implementation Example
RSA Decryption Implementation Example
What is ECC? (Elliptic Curve Cryptography)
• ECC is a type of public-key cryptography that uses elliptic curves to
perform cryptographic operations.
• ECC is based on the difficulty of solving the elliptic curve discrete
logarithm problem.
How does ECC work?
• ECC works by using an elliptic curve to represent points. These points
can be added and multiplied together, and the results can be used to
encrypt and decrypt data.
• The public key is used to encrypt data, and the private key is used to
decrypt data. The public key can be shared with anyone, but the
private key must be kept secret.
Advantages of ECC
• Efficiency: ECC is much more efficient than traditional public-key
cryptography, such as RSA. This is because ECC uses smaller keys,
which means that less computation is required to encrypt and
decrypt data.
• Security: ECC is also much more secure than traditional public-key
cryptography, such as RSA. This is because the elliptic curve discrete
logarithm problem is much more difficult to solve than the RSA
problem.
• Versatility: ECC can be used in a variety of applications, including e-
commerce, online banking, and digital signatures.
Disadvantages of ECC
• DSA is a secure and efficient algorithm that is widely used for digital
signatures.
• It is used in a variety of applications, including
• electronic commerce,
• email security,
• Software distribution.
DSA Advantage
• DSA has a number of advantages over other digital signature
algorithms, including:
• Security: DSA is a secure algorithm because it is based on the Discrete
Logarithm Problem, which is a difficult problem to solve.
• Efficiency: DSA is an efficient algorithm, which means that it is relatively fast
to create and verify signatures.
• Scalability: DSA can be scaled to support large messages and documents.
• Flexibility: DSA can be used in a variety of applications, including electronic
commerce, email security, and software distribution.
DSA Limitation
• DSA has a number of limitations, including:
• Computational complexity: DSA is a computationally complex algorithm,
which means that it requires a significant amount of computation to create
and verify signatures. This can make DSA a less attractive choice for
applications where speed is important.
• Key size: DSA uses a key size of 1024 bits or 2048 bits. This means that DSA
keys are larger than keys used by some other digital signature algorithms.
Larger keys can make DSA less efficient and more difficult to manage.
DSA Implementation Example
DSA Implementation Example
ElGamal
• ElGamal is an asymmetric encryption algorithm that was proposed by
Taher ElGamal in 1985.
• It is based on the discrete logarithm problem and is similar to the
Diffie-Hellman key exchange algorithm.
• ElGamal encryption is an asymmetric encryption algorithm that is
based on the Diffie-Hellman key exchange algorithm.
How ElGamal Work
• Alice and Bob agree on a large prime number p and a generator g.
• Alice chooses a random private key a and computes her public key A =
g^a mod p.
• Bob chooses a random private key b and computes his public key B =
g^b mod p.
• Alice sends her public key A to Bob.
• Bob sends his public key B to Alice.
• Alice chooses a random message M.
How ElGamal Work
• Alice computes the ciphertext C1 = g^k mod p and C2 = M^k mod p,
where k = (B^a) mod p.
• Alice sends the ciphertext (C1, C2) to Bob.
• Bob computes the plaintext M = C2^b mod p.
Key exchange in
Diffie-Hellman 2048-4096 bits 112-256 bits Yes No Medium secure
communication
Digital signatures,
DSA 2048-3072 112-256 bits No Yes Medium
non-repudiation
Encryption, key
ElGamal 2048-4096 112-256 bits Yes Yes Medium
exchange
Encryption, hybrid
RSA-OAEP 2048-4096 112-256 bits Yes No Medium
encryption