GithubHelp home page GithubHelp logo

f-wntp27 / rsa-aes-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from imarbles/rsa-aes-example

0.0 0.0 0.0 17 KB

Example for using RSA and AES together for both Java and C#

Java 52.00% C# 48.00%

rsa-aes-example's Introduction

RSA & AES Example

RSA2048 and AES256 as keys for Java and C#.

Codes used allows encryption and decryption between both languages.

Usage

  • Change the Constants.java/Constants.cs to the file path in use
  • Run Encryptor class to encrypt file (FILE_TO_ENCRYPT)
  • Encrypted file: ENCRYPTED_FILE
  • Run Decryptor class to decrypt file (ENCRYPTED_FILE)
  • Decrypted file: DECRYPTED_FILE

Note: RSA keys can be generated using the RSAKeyGenerator class provided in the Java version.

Logic

The expected input/output for file bytes:
[ENCRYPTED_AES_KEY] [IV BYTES] [ENCRYPTED FILE CONTENT]

Encrypting

  1. Generate an AES key
  2. Encrypt the file content using the generated AES key (IV is also attached to the file bytes)
  3. Encrypt the AES key with RSA public key
  4. Combine encrypted AES key with encrypted file content

Decrypting

  1. Breakdown file bytes into the three portions (256 AES, 16 IV, Remaining bytes for file content)
  2. Decrypt AES key with RSA private key
  3. Decrypt file content using decrypted AES key with IV

rsa-aes-example's People

Contributors

amabelyeo avatar imarbles avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.