Asymmetric Key Encryption
In asymmetric key encryption, the private key is held by one party only—the receiver or owner of the data. The sender of the data, who is not considered the owner, uses what we call a public key to encrypt the data. The public key can be held by anyone without jeopardizing any previously encrypted messages. This is considered a more secure way of handling encryption, as only the receiver can decrypt the message.
Exercise 2: Encrypting the String Using the RSA Asymmetric Key Encryption
Encrypt the "My secret message
" message using the Rivest–Shamir–Adleman (RSA) asymmetric key encryption. This is a public/private key combination:
- Open the
Chapter10
project in IDEA if it's not already open. - Create a new Java class using the
File -> New -> Java Class
menu. - Enter
Exercise2
asName
, and then selectOK
. You should now have an empty class in your project:package com.packt.java.chapter10; public class...