[DLL] CeoneCrypto 1.0.0.0

Plugins y todo lo relacionado para Autoplay Media Studio.
Imagen

CeoneCrypto

Buenas después de varios dias de estar picando teclar y aprendiendo un poco como mierda funcionan los algoritmos de encriptación he creado una DLL con la cual podreis encriptar y desencryptar contenidos de manera fácil y rápida, por ahora en todas las pruebas que he echo a funciona bien, el unico problema que he detectado es altratar de desencriptar contenidos que no estan encriptados en el formato especifico la dll se cuelga exceptuando Twofish imagino que tiene que ver con el salt... pero bueno la verdad es que es la primera versión y ya estoy pensado en nuevas versiones con mas funciones mas opciones y a fin de cuenta mas y mas y mas cogido...

Codigo:
UnmanagedExports.cs:
using System;
using System.IO;
using System.Text;
using System.Security.Cryptography;
using RGiesecke.DllExport;
using System.Collections.Generic;
using ManyMonkeys.Cryptography;
using System.Windows.Forms;
using BlowFishCS;
using CeoneCryptoA;

namespace Crypto
{
internal static class CeoneCrypto
{
/////////////////////////////////////////////////////////////
/////////////////////////// Other Functions from Crypto /////
/////////////////////////////////////////////////////////////
public static string GenerateSimpleSalt(int maxSize = 64)
{
var alphaSet = new char[64];
alphaSet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890#!".ToCharArray();
var crypto = new RNGCryptoServiceProvider();
var bytes = new byte[maxSize];
crypto.GetBytes(bytes);
var tempSB = new StringBuilder(maxSize);
foreach (var b in bytes)
{
tempSB.Append(alphaSet[b % (alphaSet.Length)]);
}
return tempSB.ToString();
}

public static byte[] StrToByteArray(string str)
{
ASCIIEncoding encoding = new ASCIIEncoding();
return encoding.GetBytes(str);
}

/////////////////////////////////////////////////////////////
/////////////////////////// Encrypt and Decrypt Strings /////
/////////////////////////////////////////////////////////////
[DllExport("AESEncrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string AESEncrypt(string value, string password, string salt)
{
if (salt == null | salt == "")
{
salt = GenerateSimpleSalt(16);
}
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));
SymmetricAlgorithm algorithm = SymmetricAlgorithm.Create();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateEncryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream())
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Write))
{
using (StreamWriter writer = new StreamWriter(stream, Encoding.Unicode))
{
writer.Write(value);
}
}
return Convert.ToBase64String(buffer.ToArray());
}
}

[DllExport("AESDecrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string AESDecrypt(string text, string password, string salt)
{
if (salt == null | salt == "")
{
salt = GenerateSimpleSalt(16);
}
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));
SymmetricAlgorithm algorithm = SymmetricAlgorithm.Create();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateDecryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream(Convert.FromBase64String(text)))
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Read))
{
using (StreamReader reader = new StreamReader(stream, Encoding.Unicode))
{
return reader.ReadToEnd();
}
}
}
}

[DllExport("RijndaelEncrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string RijndaelEncrypt(string plainText, string passPhrase, string saltValue, string hashAlgorithm, int passwordIterations, string initVector, int keySize)
{
if (saltValue == null | saltValue == "")
{
saltValue = GenerateSimpleSalt(16);
}
byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector);
byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue);
byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText);
PasswordDeriveBytes password = new PasswordDeriveBytes(passPhrase, saltValueBytes, hashAlgorithm, passwordIterations);
byte[] keyBytes = password.GetBytes(keySize / 8);
RijndaelManaged symmetricKey = new RijndaelManaged();
symmetricKey.Mode = CipherMode.CBC;
ICryptoTransform encryptor = symmetricKey.CreateEncryptor(keyBytes, initVectorBytes);
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write);
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
cryptoStream.FlushFinalBlock();
byte[] cipherTextBytes = memoryStream.ToArray();
memoryStream.Close();
cryptoStream.Close();
string cipherText = Convert.ToBase64String(cipherTextBytes);
return cipherText;
}

[DllExport("RijndaelDecrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string RijndaelDecrypt(string cipherText, string passPhrase, string saltValue, string hashAlgorithm, int passwordIterations, string initVector, int keySize)
{
if (saltValue == null | saltValue == "")
{
saltValue = GenerateSimpleSalt(16);
}
byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector);
byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue);
byte[] cipherTextBytes = Convert.FromBase64String(cipherText);
PasswordDeriveBytes password = new PasswordDeriveBytes(passPhrase, saltValueBytes, hashAlgorithm, passwordIterations);
byte[] keyBytes = password.GetBytes(keySize / 8);
RijndaelManaged symmetricKey = new RijndaelManaged();
symmetricKey.Mode = CipherMode.CBC;
ICryptoTransform decryptor = symmetricKey.CreateDecryptor(keyBytes, initVectorBytes);
MemoryStream memoryStream = new MemoryStream(cipherTextBytes);
CryptoStream cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read);
byte[] plainTextBytes = new byte[cipherTextBytes.Length];
int decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);
memoryStream.Close();
cryptoStream.Close();
string plainText = Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount);
return plainText;
}

[DllExport("RC2Encrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string RC2Encrypt(string value, string password, string salt)
{
if (salt == null | salt == "")
{
salt = GenerateSimpleSalt(16);
}
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));
RC2 algorithm = RC2.Create();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateEncryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream())
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Write))
{
using (StreamWriter writer = new StreamWriter(stream, Encoding.Unicode))
{
writer.Write(value);
}
}
return Convert.ToBase64String(buffer.ToArray());
}
}

[DllExport("RC2Decrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string RC2Decrypt(string text, string password, string salt)
{
if (salt == null | salt == "")
{
salt = GenerateSimpleSalt(16);
}
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));
RC2 algorithm = RC2.Create();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateDecryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream(Convert.FromBase64String(text)))
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Read))
{
using (StreamReader reader = new StreamReader(stream, Encoding.Unicode))
{
return reader.ReadToEnd();
}
}
}
}

[DllExport("DESEncrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string DESEncrypt(string value, string password, string salt)
{
if (salt == null | salt == "")
{
salt = GenerateSimpleSalt(16);
}
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));
DES algorithm = DES.Create();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateEncryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream())
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Write))
{
using (StreamWriter writer = new StreamWriter(stream, Encoding.Unicode))
{
writer.Write(value);
}
}
return Convert.ToBase64String(buffer.ToArray());
}
}

[DllExport("DESDecrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string DESDecrypt(string text, string password, string salt)
{
if (salt == null | salt == "")
{
salt = GenerateSimpleSalt(16);
}
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));
DES algorithm = DES.Create();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateDecryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream(Convert.FromBase64String(text)))
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Read))
{
using (StreamReader reader = new StreamReader(stream, Encoding.Unicode))
{
return reader.ReadToEnd();
}
}
}
}

[DllExport("TripleDESEncrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string TripleDESEncrypt(string value, string password, string salt)
{
if (salt == null | salt == "")
{
salt = GenerateSimpleSalt(16);
}
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));
TripleDES algorithm = TripleDES.Create();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateEncryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream())
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Write))
{
using (StreamWriter writer = new StreamWriter(stream, Encoding.Unicode))
{
writer.Write(value);
}
}
return Convert.ToBase64String(buffer.ToArray());
}
}

[DllExport("TripleDESDecrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string TripleDESDecrypt(string text, string password, string salt)
{
if (salt == null | salt == "")
{
salt = GenerateSimpleSalt(16);
}
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));
TripleDES algorithm = TripleDES.Create();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateDecryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream(Convert.FromBase64String(text)))
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Read))
{
using (StreamReader reader = new StreamReader(stream, Encoding.Unicode))
{
return reader.ReadToEnd();
}
}
}
}

[DllExport("TwofishEncrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string TwofishEncrypt(string text, string password, string salt)
{
if (salt == null | salt == "")
{
salt = GenerateSimpleSalt(16);
}
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));
SymmetricAlgorithm algorithm = Twofish.Create();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateEncryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream())
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Write))
{
using (StreamWriter writer = new StreamWriter(stream, Encoding.Unicode))
{
writer.Write(text);
}
}
return Convert.ToBase64String(buffer.ToArray());
}
}

[DllExport("TwofishDecrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string TwofishDecrypt(string text, string password, string salt)
{
if (salt == null | salt == "")
{
salt = GenerateSimpleSalt(16);
}
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));
SymmetricAlgorithm algorithm = Twofish.Create();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateDecryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream(Convert.FromBase64String(text)))
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Read))
{
using (StreamReader reader = new StreamReader(stream, Encoding.Unicode))
{
return reader.ReadToEnd();
}
}
}
}

[DllExport("BlowfishEncrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string BlowfishEncrypt(string text, string password)
{
BlowFish b = new BlowFish(password);
return b.Encrypt_CBC(text);
}

[DllExport("BlowfishDecrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string BlowfishDecrypt(string text, string password)
{
BlowFish b = new BlowFish(password);
return b.Decrypt_CBC(text);
}

[DllExport("XOREncrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string XOREncrypt(string text, string password, string salt)
{
if (salt == null | salt == "")
{
salt = GenerateSimpleSalt(16 + 93488);
}
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt + 93488));
SymmetricAlgorithm algorithm = XOR.Create();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateEncryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream())
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Write))
{
using (StreamWriter writer = new StreamWriter(stream, Encoding.Unicode))
{
writer.Write(text);
}
}
return Convert.ToBase64String(buffer.ToArray());
}
}

[DllExport("XORDecrypt", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string XORDecrypt(string text, string password, string salt)
{
if (salt == null | salt == "")
{
salt = GenerateSimpleSalt(16 + 93488);
}
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt + 93488));
SymmetricAlgorithm algorithm = XOR.Create();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateDecryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream(Convert.FromBase64String(text)))
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Read))
{
using (StreamReader reader = new StreamReader(stream, Encoding.Unicode))
{
return reader.ReadToEnd();
}
}
}
}

/////////////////////////////////////////////////////////////
/////////////////////////// About Function of Crypto :) /////
/////////////////////////////////////////////////////////////

[DllExport("About", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static string About()
{
Form1 Form1 = new Form1();
Form1.Show();
return "";
}
}
}


En cuanto pueda me pasare por paste2 y copiare el resto de códigos que me falta por poner...

Descarga:
HIDE: ON
Hidebb Message Hidden Description
gracias
Thank you
excelente<div>
</div>
a probar
y este form para que es?

// Type: CeoneCryptoA.Form1
// Assembly: CeoneCrypto, Version=1.0.0.31563, Culture=neutral, PublicKeyToken=null
// Assembly location: C:\Users\Pabloko\Desktop\CeoneCrypto.dll

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;

namespace CeoneCryptoA
{
public class Form1 : Form
{
private IContainer components;
private Button buttonpaypal;
private Label label1;
private Label label2;
private Button button1;
private LinkLabel linkLabel1;

public Form1()
{
this.InitializeComponent();
}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start(new ProcessStartInfo()
{
FileName = "http://amsspecialist.com/",
Verb = "open",
WindowStyle = ProcessWindowStyle.Maximized
});
}

private void button1_Click(object sender, EventArgs e)
{
this.Close();
}

private void buttonpaypal_Click(object sender, EventArgs e)
{
Process.Start(new ProcessStartInfo()
{
FileName = "https://www.paypal.com/cgi-bin/webscr?c ... 2XAP9X65RA",
Verb = "open",
WindowStyle = ProcessWindowStyle.Maximized
});
}

protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
this.components.Dispose();
base.Dispose(disposing);
}

private void InitializeComponent()
{
ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (Form1));
this.buttonpaypal = new Button();
this.label1 = new Label();
this.label2 = new Label();
this.button1 = new Button();
this.linkLabel1 = new LinkLabel();
this.SuspendLayout();
this.buttonpaypal.Image = (Image) componentResourceManager.GetObject("buttonpaypal.Image");
this.buttonpaypal.Location = new Point(12, 126);
this.buttonpaypal.Name = "buttonpaypal";
this.buttonpaypal.Size = new Size(78, 37);
this.buttonpaypal.TabIndex = 0;
this.buttonpaypal.UseVisualStyleBackColor = true;
this.buttonpaypal.Click += new EventHandler(this.buttonpaypal_Click);
this.label1.Location = new Point(11, 20);
this.label1.Name = "label1";
this.label1.Size = new Size(242, 103);
this.label1.TabIndex = 1;
this.label1.Text = "Version: 1.0.0.0\r\n\r\n\r\nCeoneCrypto based on RijndaelCrypt.dll\r\nMore information about this and many other\r\ncontent in AMSSpecialist Forum.";
this.label1.TextAlign = ContentAlignment.MiddleCenter;
this.label2.AutoSize = true;
this.label2.Font = new Font("Microsoft Sans Serif", 10.25f, FontStyle.Bold, GraphicsUnit.Point, (byte) 0);
this.label2.Location = new Point(86, 6);
this.label2.Name = "label2";
this.label2.Size = new Size(92, 17);
this.label2.TabIndex = 2;
this.label2.Text = "CeoneCrypt";
this.button1.Location = new Point(178, 126);
this.button1.Name = "button1";
this.button1.Size = new Size(78, 37);
this.button1.TabIndex = 3;
this.button1.Text = "Exit";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new EventHandler(this.button1_Click);
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new Point(69, 50);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new Size(129, 13);
this.linkLabel1.TabIndex = 4;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "http://AMSSpecialist.com";
this.linkLabel1.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
this.AutoScaleDimensions = new SizeF(6f, 13f);
this.AutoScaleMode = AutoScaleMode.Font;
this.ClientSize = new Size(268, 170);
this.Controls.Add((Control) this.linkLabel1);
this.Controls.Add((Control) this.button1);
this.Controls.Add((Control) this.label2);
this.Controls.Add((Control) this.label1);
this.Controls.Add((Control) this.buttonpaypal);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = FormStartPosition.CenterScreen;
this.Text = "About";
this.ResumeLayout(false);
this.PerformLayout();
}
}
}
es el acerca... pensé en ponerlo en plan messagebox pero como quería meter algo con algunas opciones mas...
gracias

thanks

nice ceone

provando

a provar

enlace de descarga está muerto podría volver a subir

thanks
thanks
manda pra mim
nice .
Graças
Graças
:fry-1414025241: