Security

  • Thread starter http://sterlingdeepwaterbay.ath.cx
  • Start date
H

http://sterlingdeepwaterbay.ath.cx

I am working on excryption for software my company si developing. Its
fairly simple. I use Rijndael Algorith , we could use DES or MD5.

Do you think that this way in secure enough.

Key is stored in the program. No way for any users to know it without
decompiling the prog.

login.db -> encrypted to log.enc
when an operation needs the db
decrypt(log.enc, key) ->login.db
perform operation
encrypt(login.db, key) -> log.enc

there will be some time elapsed where the db is vulnerable. But I
dont see a way around that unless we use a text file instead which
will complicate things.

Encyption
using System;
using System.IO;
using System.Text;
using System.Security.Cryptography;

namespace Encrypt
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Encrypt
{
[STAThread]
static void Main(string[] args)
{
UnicodeEncoding ue = new UnicodeEncoding();
byte[] key = ue.GetBytes("ehrtr43l");

FileStream fs = new FileStream("login.enc", FileMode.Create);

RijndaelManaged RMCrypto = new RijndaelManaged();
CryptoStream cs = new CryptoStream(fs,
RMCrypto.CreateEncryptor(key, key), CryptoStreamMode.Write);

Console.WriteLine("Encrypting " + args[0] + " ...");
FileStream fsIn=new FileStream(args[0],FileMode.Open);



int data;
while ((data=fsIn.ReadByte())!=-1)
cs.WriteByte((byte) data);
}
}
}

Decryption
using System;
using System.Security.Cryptography;
using System.Text;
using System.IO;

namespace Decrypt
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Decrypt
{
[STAThread]
static void Main(string[] args)
{
UnicodeEncoding ue = new UnicodeEncoding();
byte[] key = ue.GetBytes("ehrtr43l");

FileStream fsIn = new FileStream("login.enc", FileMode.Open);
FileStream fsOut = new FileStream("out.txt", FileMode.Create);

RijndaelManaged RMCrypto = new RijndaelManaged();
CryptoStream cs = new CryptoStream(fsOut,
RMCrypto.CreateDecryptor(key, key), CryptoStreamMode.Write);

Console.WriteLine("Decrypting login.enc ...");

int data;
while ((data=fsIn.ReadByte())!=-1)
cs.WriteByte((byte) data);
}

}
}
 
C

Christopher Benson-Manica

A

Alex Monjushko

http://sterlingdeepwaterbay.ath.cx said:
I am working on excryption for software my company si developing. Its
fairly simple. I use Rijndael Algorith , we could use DES or MD5.

Do you think that this way in secure enough.

Key is stored in the program. No way for any users to know it without
decompiling the prog.

Your query is off-topic and the source code you supplied is not C.
You may want to try the following newsgroups:

comp.programming
sci.crypt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top