0

Could someone provide a starting point for encrypting a generic dictionary in .NET?

UPDATE Basically I'm storing a bunch of string values with string keys. This dictionary is storing quite a few items though. I'm not sure whether encrypting the content would be better vs encrypting the dictionary.

Edward
  • 7,346
  • 8
  • 62
  • 123

2 Answers2

1

See this question on encrypting/decrypting strings.

If you want to encrypt the whole Dictionary object you first need to copy it to a SortedList<string, string> or similar. XmlSerialization doesn't support IDictionary-objects (neither does KeyValuePair).

Here is a wrapper class for Dictionary that supports serialization.

Community
  • 1
  • 1
Tedd Hansen
  • 12,074
  • 14
  • 61
  • 97
1

You can try this link

And may be use a simple XOR encryption like this (if that serves your purpose) or use some build-in .net classes for encryption.

Vishal Seth
  • 4,948
  • 7
  • 26
  • 28