shill: Infrastucture for encrypting/decrypting/scrambling store values.
This adds a CryptoProvider that registers and provides access to different
prioritized crypto modules (currently DES-CBC and ROT47). Use the provider in
KeyFileStore to provide an API for getting and setting crypted string values.
BUG=chromium-os:16963
TEST=unit tests
Change-Id: I492516890eb3f527758d354cd8890088cb99dea4
Reviewed-on: http://gerrit.chromium.org/gerrit/3395
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
diff --git a/store_interface.h b/store_interface.h
index cd0fbbd..46a71cc 100644
--- a/store_interface.h
+++ b/store_interface.h
@@ -77,6 +77,19 @@
virtual bool SetInt(const std::string &group,
const std::string &key,
int value) = 0;
+
+ // Gets and decrypts string |value| associated with |group|:|key|. Returns
+ // true on success and false on failure (including when |group|:|key| is not
+ // present in the store).
+ virtual bool GetCryptedString(const std::string &group,
+ const std::string &key,
+ std::string *value) = 0;
+
+ // Associates |group|:|key| with a string |value| after encrypting it. Returns
+ // true on success, false otherwise.
+ virtual bool SetCryptedString(const std::string &group,
+ const std::string &key,
+ const std::string &value) = 0;
};
} // namespace shill