473,624 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Short Strings - Data Encryption/Decryption

I have googled and tested and tried and still I can't seem to implement a
simple encryption/decryption console application. My goal is to create two
methods.

public byte[] Encrypt(string DataToEncrypt, string Key)
{
...
}

public byte[] Decrypt(byte[] DataToDecrypt, string Key)
{
...
}
The Key parameter *should* be a variable-length string (an alpha-numeric
password if you will). I'm at a loss at where to go from here...gah!

Any and all help is greatly appreciated,

Mythran

May 25 '06 #1
3 3957

"Mythran" <ki********@hot mail.comREMOVET RAIL> wrote in message
news:O8******** ******@TK2MSFTN GP04.phx.gbl...
I have googled and tested and tried and still I can't seem to implement a
simple encryption/decryption console application. My goal is to create two
methods.

public byte[] Encrypt(string DataToEncrypt, string Key)
{
...
}

public byte[] Decrypt(byte[] DataToDecrypt, string Key)
{
...
}
The Key parameter *should* be a variable-length string (an alpha-numeric
password if you will). I'm at a loss at where to go from here...gah!

Any and all help is greatly appreciated,

Mythran


Nevermind ... of course after I post, I find out how :P

Mythran

May 25 '06 #2
I was going to suggest the System.Security .Cryptography namespace. Might be
worth following up if that's not the method you used for your solution.

"Mythran" <ki********@hot mail.comREMOVET RAIL> wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..

"Mythran" <ki********@hot mail.comREMOVET RAIL> wrote in message
news:O8******** ******@TK2MSFTN GP04.phx.gbl...
I have googled and tested and tried and still I can't seem to implement a
simple encryption/decryption console application. My goal is to create
two methods.

public byte[] Encrypt(string DataToEncrypt, string Key)
{
...
}

public byte[] Decrypt(byte[] DataToDecrypt, string Key)
{
...
}
The Key parameter *should* be a variable-length string (an alpha-numeric
password if you will). I'm at a loss at where to go from here...gah!

Any and all help is greatly appreciated,

Mythran


Nevermind ... of course after I post, I find out how :P

Mythran

May 26 '06 #3
Yeah, I played with the Cryptography namespace and reviewed every provider
class in it...and I just couldn't figure out how to do it until I posted the
2nd post lol...my solution was using the TripleDESCrypto ServiceProvider
along with PasswordDeriveB ytes classes :)

Mythran
"Mike C#" <xx*@yyy.com> wrote in message news:To******** ******@fe08.lga ...
I was going to suggest the System.Security .Cryptography namespace. Might
be worth following up if that's not the method you used for your solution.

"Mythran" <ki********@hot mail.comREMOVET RAIL> wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..

"Mythran" <ki********@hot mail.comREMOVET RAIL> wrote in message
news:O8******** ******@TK2MSFTN GP04.phx.gbl...
I have googled and tested and tried and still I can't seem to implement a
simple encryption/decryption console application. My goal is to create
two methods.

public byte[] Encrypt(string DataToEncrypt, string Key)
{
...
}

public byte[] Decrypt(byte[] DataToDecrypt, string Key)
{
...
}
The Key parameter *should* be a variable-length string (an alpha-numeric
password if you will). I'm at a loss at where to go from here...gah!

Any and all help is greatly appreciated,

Mythran


Nevermind ... of course after I post, I find out how :P

Mythran



May 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
5478
by: sffan | last post by:
I am new to database programming and was curious how others solve the problem of storing encrypted in data in db table columns and then subsequently searching for these records. The particular problem that I am facing is in dealing with (privacy) critical information like credit-card #s and SSNs or business critical information like sales opportunity size or revenue in the database. The requirement is that this data be stored encrypted...
2
4192
by: Dave Bailey | last post by:
I have developed a web app using DPAPI to encrypt a connection string in the web.config file. The application works perfectly on the development machine but when deployed to the server when opening the app the following wrror is generated: Exception decrypting. Decryption failed. Key not valid for use in specified state. Description: An unhandled exception occurred during the execution of the current web request. Please review the
9
5147
by: sweety | last post by:
Dear All, How to encrypt a C data file and make binary file and then have to read a bin file at run time and decrypt the file and have to read the data. Any help to achive this pls. Would be great if any sample source code provided. Thanks, Sweety
0
3360
by: Hannibal111111 | last post by:
I found this code on a site for doing string encryption/decryption. The string will encrypt fine, but I get this error when I try to decrypt. Any idea why? I posted the code below. The error actually points to this line of code in byte decrypt function: cs.FlushFinalBlock(); public static byte encrypt(byte clearData, byte Key, byte IV)
15
1991
by: pkirk25 | last post by:
I have a file with roughly 1000 lines that I cannot allow the user to read but which I want to use in my project. I thought I could copy it into one huge string variable but that won't work because of the line breaks. Is there a way to enclos ethis data in 1 huge variable that tehn gets compiled into the exutable?
4
5690
by: Fritjolf | last post by:
Hi. I've got a strange problem... I've made a simple program to test encryption/decryption. I use Rijndael encryption and here are the most important properties. RijndaelManaged cipher = new RijndaelManaged(); cipher.KeySize = 256; cipher.BlockSize = 256;
13
3569
by: Tom Andrecht | last post by:
I'm trying to get some encryption/decryption routines going to take care of my data, and while the encryption is working great, I keep running into the message "Padding is invalid and cannot be removed" on the decryption piece. From everything I can see, I am doing things correctly here My code is as follows: private const string PassStr = "MyPrivateKey"; private static readonly byte PassSalt = new byte { Byte Byte Byte Byte Byte};...
5
9500
by: Netwatcher | last post by:
well, i started messing around with dictionaries, yet, most of the pages i found about them always talk about getting only one word out of it and turning it vice versa, i've been playing with that code for a few hours: #dics Encryption={',':'hy{;',' ':'h4x0r2','':'zomg','?':'bko','a':'ika','b':'d0v','c':'ino', 'd':'maw', 'e':'aon', 'f':'que', 'g':'kip', 'h':'an', 'n':'ko print lol except KeyError: print 'These...
9
4811
by: Betikci Boris | last post by:
I get bored last night and wrote a script that uses xor for encrypt- decrypt, however it woks fine under linux 2.6.25, text and documents are ok, but fails on compressed files *.jpg, *.pdf , etc . I didn't test script on windows. Here is the code, please send me your views. <?php /* Mother Eye Chipper with PHP :), Licence:GPL,
0
8680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7168
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2610
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.