louresb / CryptographyAPI

This repository contains the solution for a challenge offered by Back-End Brasil, the official community hub for Brazilian backenders.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CryptographyAPI

licence mit Development Status Badge

This API is developed as a solution for a challenge offered by Back-End Brasil, the official community hub for Brazilian backenders.

Technologies Used

  • C#
  • .NET
  • ASP.NET
  • Entity Framework Core
  • Microsoft SQL Server

Challenge description

Your challenge will be to implement encryption in a service transparently for both the API and the service layers of your application. The goal is to ensure that sensitive fields of entity objects are not directly visible. This will involve performing encryption at runtime during the conversion of entities to the corresponding columns in the database, and vice versa.

Example

Consider the fields "userDocument" and "creditCardToken" as sensitive fields that need to be encrypted. The example table would look like this:

id userDocument creditCardToken value
1 MzYxNDA3ODE4MzM= YWJjMTIz 5999
2 MzI5NDU0MTA1ODM= eHl6NDU2 1000
3 NzYwNzc0NTIzODY= Nzg5eHB0bw== 1500

The structure of the corresponding entity would be as follows:

Field Type
id Long
userDocument String
creditCardToken String
value Long

Requirements

  • Implement a simple CRUD considering the aforementioned fields as sensitive.
  • Use the encryption algorithm of your preference.

Screenshots

Post new user

Post Post 200

"userDocument" and "creditCardToken" encrypted at the database

Db encrypted

Get decrypted data from database

Get

Installation

  1. Clone the repository:
git clone https://github.com/louresb/CryptographyAPI
  1. Navigate to the project directory:
cd CryptographyAPI
  1. Build the project:
dotnet build
  1. Make sure to have SQL Server
dotnet ef database update
  1. Run the project:
dotnet run

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

MIT License © Bruno Loures

About

This repository contains the solution for a challenge offered by Back-End Brasil, the official community hub for Brazilian backenders.

License:MIT License


Languages

Language:C# 100.0%