The Secure Message Application is a web-based platform that allows users to send and receive encrypted messages securely. The application uses RSA encryption to ensure that messages are only readable by the intended recipient. The application is built using Spring Boot, Thymeleaf, and Bootstrap for the frontend.
- User registration and authentication
- Sending and receiving encrypted messages
- Viewing sent and received messages
- Secure storage of user keys
User keys are generated using RSA encryption. Each user has a unique pair of public and private keys. The keys are stored in the database as byte arrays. The public key is used to encrypt messages, while the private key is used to decrypt messages.
The keys are generated and stored as follows:
- When a user registers, a new RSA key pair is generated.
- The public and private keys are encoded and stored in the database.
- The public key is used to encrypt messages sent to the user.
- The private key is used to decrypt messages received by the user.
Messages are encrypted using the recipient's public key. The encryption process ensures that only the recipient can decrypt and read the message using their private key.
The encryption process is as follows:
- The sender writes a message and selects a recipient.
- The application retrieves the recipient's public key from the database.
- The message is encrypted using the recipient's public key.
- The encrypted message is stored in the database and sent to the recipient.
Messages are decrypted using the recipient's private key. The decryption process ensures that only the recipient can read the message.
The decryption process is as follows:
- The recipient logs in to the application.
- The application retrieves the recipient's private key from the database.
- The encrypted message is retrieved from the database.
- The message is decrypted using the recipient's private key and displayed to the recipient.
- Spring Boot
- Thymeleaf
- Bootstrap
- RSA Encryption
To get started with the Secure Message Application, follow these steps:
- Clone the repository.
- Set up the database and configure the connection in
src/main/resources/application.properties
. - Create certificates and keys with
openssl req -newkey rsa:2048 -x509 -sha256 -keyout server.key -out server.crt -days 365 -subj "/CN=self-signed-no-encrypt-key-cert" -nodes
and move created files toserver/certs
folder. - Run the application using
mvn spring-boot:run
. - Access the application at
http://localhost:8080
.
For more detailed instructions, refer to the documentation in the repository.
This project is licensed under the MIT License. See the LICENSE file for details.