A simple web application for Encrpytion / Decryption
- Java 8
- Spring boot
- H2 in memory database
- Maven as dependency manager
- Javascript, HTML and CSS for UI
java -jar TestAssignment-0.0.1-SNAPSHOT.jar
After this API will listen http://localhost:8080/
cd UI/
npm install live-server
node main.js
After this UI is opened http://localhost:8081/
You can import it your IDE as a Maven project.
In Eclipse: Import -> Maven -> Existing Maven projects
You can find more in: https://spring.io/guides/gs/serving-web-content/
After you running both UI and API
- In UI, put your text into input area, then encrypt it with clicking "Encrypt" button. In the end, encryption will be stored in the table below.
- From the table, you can click an encrypted value. It will load it into the input area. You can decrypt it with clicking "Decrypt" button. This will show the result value in the input area. Or you can click "Encrypt", it will do rule 1.
- Text used for both operations must not be empty.
-
Encrypt a text value and save it to DB
POST http://localhost:8080/encrypt
Header: 'Content-type': 'application/json' Request body: {"encrypted": "your_text_here"}
Response: 200 with body: {"encrypted": encryption_result, "id": generated_id}
If your text is blank, then it will return 400 -
Decrypt a text value
GET http://localhost:8080/decrypt?text=your_text_here
Response: 200 with body: {"encrypted": decryption_result, "id": 0}
If your text is blank, then it will return 400 -
List all encrypted values
GET http://localhost:8080/
Response: 200 with json array as: [{"encrypted": e1, "id": id1},{"encrypted": e2, "id": id2}...]