Git Product home page Git Product logo

rsa_aes_sifreleme's Introduction

RSA - AES HYBRID ENCRYPTION-DECRYPTION

RSA - AES HİBRİT ŞİFRELEME-ÇÖZME

Build requirements

  • Visual Studio 2017
  • .NET Framework 4.5

Features

  • Asynchronous (You can use async/await)
  • RSA-AES Hybrid Encryption-Decryption (My Algorithm)
  • RSA Encryption-Decryption (1024 Bit, 2048 Bit, 4096 Bit)
  • AES Encryption-Decryption (128 Bit, 256 Bit)
  • Diffie–Hellman Key Exchange

Examples

RSA-AES Hybrid Encryption-Decryption

  • string or byte[]
string publicKey = RsaAesHybrit.Instance.ToXmlString(false);
string privateKey = RsaAesHybrit.Instance.ToXmlString(true);

byte[] data = Encoding.UTF8.GetBytes("KEMAL");
byte[] encrypted = await RsaAesHybrit.Instance.EncryptAsync(data);
byte[] decrypted = await RsaAesHybrit.Instance.DecryptAsync(encrypted);
  • File
string testSourceFileName = "Kriptografi.exe";
string targetFileNameEnc = "Kriptografi_encrypted.enc";
string targetFileNameDec = "Kriptografi_decrypted.exe";
await RsaAesHybrit.Instance.EncryptAsync(testSourceFileName, targetFileNameEnc);
await RsaAesHybrit.Instance.DecryptAsync(targetFileNameEnc, targetFileNameDec);

AES-256 Bit Encryption-Decryption

  • byte[]
AES aes = new AES();
byte[] data = Encoding.UTF8.GetBytes(metin);
byte[] encrypted = await aes.ProcessAsync(data, AES.Cryptor.Encrypt);
byte[] decrypted = await aes.ProcessAsync(sifrele, AES.Cryptor.Decrypt);

Console.WriteLine("Key: {0}", Convert.ToBase64String(aes.Key));
Console.WriteLine("IV: {0}", Convert.ToBase64String(aes.IV));
  • File
string testSourceFileName = "Kriptografi.exe";
string targetFileNameEnc = "Kriptografi_encrypted.enc";
string targetFileNameDec = "Kriptografi_decrypted.exe";
AES aes = new AES();
await aes.ProcessAsync(testSourceFileName, targetFileNameEnc, AES.Cryptor.Encrypt);
await aes.ProcessAsync(targetFileNameEnc, targetFileNameDec, AES.Cryptor.Decrypt);

Diffie–Hellman Key Exchange

using (var bob = new DiffieHellman())
using (var alice = new DiffieHellman())
{
	Console.WriteLine("Bob Private Key: {0}\n", Convert.ToBase64String(bob.PrivateKey));
	Console.WriteLine("Alice Private Key: {0}\n", Convert.ToBase64String(alice.PrivateKey));

	Console.WriteLine("Bob IV: {0}\n", Convert.ToBase64String(bob.AesIV));
	Console.WriteLine("Alice IV: {0}\n", Convert.ToBase64String(alice.AesIV));
				
	byte[] data = Encoding.UTF8.GetBytes("{ KeMaL; }");

	// Bob uses Alice's public key to encrypt his data.
	byte[] secretData = await bob.EncryptAsync(alice.PublicKey, data);

	// Alice uses Bob's public key and IV to decrypt the secret data.
	byte[] decryptedData = await alice.DecryptAsync(bob.PublicKey, secretData, bob.AesIV);
}

rsa_aes_sifreleme's People

Contributors

kemalincekara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

drony varenty02

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.