Git Product home page Git Product logo

encryptor's Introduction

Encryptor

Rsa encryptor easy to use

Instalation

To install rsa encryptor:

  1. Go to releses and download Encryptor.dll and Encryptor.xml for documentation 2. Move downloaded files to your project location
  2. Add Encryptor.dll reference to your project
  3. Add:
using Encryptor;

Usage

To get started you will have to create instance of your encryptor like this:

RsaEncryptor rsaEncryptorInstance = new RsaEncryptor(1024); //key lenght = 1024 bits

Note that you can use diferent key lenghts depending on preferences

Encrypting data

To encrypt your data you just have to call function:

RSAParameters somePublicKey;
byte[] dataToEncrypt = Encoding.ASCII.GetBytes("test message");
byte[] encryptedData = rsaEncryptorInstance.encrypt(dataToEncrypt, somePublicKey);

You can also pass string as an argument:

byte[] encryptedData = rsaEncryptorInstance.encrypt("test message", somePublicKey);

Here is an example:

static RsaEncryptor rsaEncryptorInstance = new RsaEncryptor(1024);

static void Main(string[] args)
{
     string encryptedData = Encoding.ASCII.GetString(rsaEncryptorInstance.encrypt("test message", rsaEncryptorInstance.GetPublicKey()));
     Console.WriteLine(encryptedData);
}

Example output:

string output = "S??A?zA?↨?-↨?#*▲?§?>???▲NI?↕L\???.?A¶?K?/-?1?,????G??>?????F?g?O?▼??q♥:Hi?i??↨?????$?????8}cL9?5h??B↕???|2"

IMPORTANT NOTE: Please note that converting encrypted data to a string and then converting it back to byte array will break message and u won't be able to decrypt it! This was done only for demonstartion purpeses.

Decrypting data

To decrypt some data call function:

byte[] encryptedData;
byte[] decryptedData = rsaEncryptorInstance.decrypt(encryptedData);

if you want to use other private key use:

RSAParameters somePrivateKey;
byte[] encryptedData;
byte[] decryptedData = rsaEncryptorInstance.decrypt(encryptedData, somePrivateKey);

To extract string from encrypted data use:

byte[] encryptedData;
string decryptedString = rsaEncryptorInstance.decryptString(encryptedData);

License

MIT license - do whatever you want

encryptor's People

Contributors

techtematy avatar

Stargazers

 avatar

Watchers

 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.