Jump to content
Xtreme .Net Talk

Recommended Posts

  • Administrators
Posted

If you are using a shared key method then you need to ensure that the same key / IV is used to encrypt and decrypt - there isn't any real magic involved.

 

http://www.xtremedotnettalk.com/showthread.php?t=101639 has a quick example of how this can be done.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

I hate to keep bothering you about this, but I've run into a related question:

 

Given a file (could be an image, a zipped archive, a text file, PDF, etc), how could my application tell if the file has already been encrypted with my technique?

 

I want to retain whatever extensions are already on the original file formats whenever they are encrypted and replace the original file with the encrypted version - unless they are already encrypted! If they are already encrypted, I want to decrypt them. I just don't know how to test for a file or a stream already being encrypted.

  • Administrators
Posted
Probably the easiest way is when writing the encrypted version make the file contents start with a particular byte sequence, when opening the file check for this sequence - if it exists then it needs to be decrypted if it doesn't assume it is already decrypted.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...