Click here to Skip to main content
12,297,208 members (65,708 online)
Click here to Skip to main content

Stats

39K views
5.5K downloads
91 bookmarked
Posted

Encryption and compression, native and managed

, 29 Jun 2012 CPOL
DLL for native encryption and compression (using Crypto++). Includes RSA Key Generator in C#, and encryption and compression in ASP.NET (C#).
CryptoLib
CryptoLib
CryptoLib.vcproj.DDIT.eolmos.user
CryptoLib.vcproj.PCQ9300.Administrador.user
CryptoPP
Release
CryptoLib.dll
CryptoLib.exp
CryptoLib.lib
CryptTest
CryptLib
CryptoLib.lib
CryptTest.vcproj.DDIT.eolmos.user
CryptTest.vcproj.PCQ9300.Administrador.user
EXE
CryptoLib.dll
CryptTest.exe
res
CryptTest.ico
CryptTestWeb
App_Data
Bin
App_Web_f38kc34z.dll
ManagedZLib.dll
ManagedZLib.dll
RSAKeyGenerator.exe
CryptoLib.dll
CryptTest.exe
NetCryptLib.dll
NetCryptTest.exe
NETPCryptLib.dll
zlib.net.dll
RSAKeyGenerator
RSAKeyGenerator.exe
Properties
CryptCpp.suo
CryptoLib.vcproj.DDIT.eolmos.user
CryptoLib.vcproj.PCQ9300.Administrador.user
CryptoLib.vcxproj.filters
CryptoLib.vcxproj.user
CryptoPP
CryptTest.aps
CryptTest.vcproj.DDIT.eolmos.user
CryptTest.vcproj.PCQ9300.Administrador.user
CryptTest.vcxproj.filters
CryptTest.vcxproj.user
CryptTest.ico
ManagedZLib.dll
NetCryptLib
app.ico
NetCryptLib.vcxproj.filters
NetCryptLib.vcxproj.user
NetCryptTest
NetCryptTest.csproj.user
Properties
app.manifest
NETPCryptLib
Properties
NetWebTest
NetWebTest.csproj.user
Properties
NETZLib
RSAKeyGenerator.suo
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using RSAKeyGenerator;

namespace RSAKeyGenerator
{
    public partial class FrmRSAKeyGen : Form
    {
        public FrmRSAKeyGen()
        {
            InitializeComponent();
        }

        private void CmdExit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void CmdGenerate_Click(object sender, EventArgs e)
        {
            RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(1024);
            RSAParameters RSAKeyInfo = rsa.ExportParameters(true);
            string str="";
            str += GetKeyText("parammodulus", RSAKeyInfo.Modulus) + "\r\n";
            str += GetKeyText("exponent", RSAKeyInfo.Exponent) + "\r\n";
            str += GetKeyText("paramdp", RSAKeyInfo.DP) + "\r\n";
            str += GetKeyText("paramdq", RSAKeyInfo.DQ) + "\r\n";
            str += GetKeyText("paramp", RSAKeyInfo.P) + "\r\n";
            str += GetKeyText("paramq", RSAKeyInfo.Q) + "\r\n";
            str += GetKeyText("inverseq", RSAKeyInfo.InverseQ) + "\r\n";
            str += GetKeyText("paramd", RSAKeyInfo.D) + "\r\n";
            TxtCode.Text = str;
        }
        private string GetKeyText(string name, byte[] param)
        {
            string str="";
            str = "byte " + name + "[] = " + GetByteStr(param) + ";";
            return str;
        }
        private string GetByteStr(byte[] param)
        {
            string str="{";
            for (int i = 0; i <= param.Length - 1; i++)
            {
                if (i== param.Length - 1)
                    str += param[i].ToString();
                else
                    str += param[i].ToString() + ",";
            }
            str += "}";
            return str;
        }

        private void FrmRSAKeyGen_Load(object sender, EventArgs e)
        {

        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ErnestoNet
Software Developer
Argentina Argentina
System developer from Argentina.

Programmed in VB 5,6,.NET, C#, Java, PL-SQL, Transac-SQL, C, C++ and even some "calculator" language.

Love to build small, useful applications.
Usually building big and complicated apps based on solid, reliable components.

Hobbies: reading, photography, chess, paddle, running.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160525.2 | Last Updated 29 Jun 2012
Article Copyright 2009 by ErnestoNet
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid