Darin Petkov | 877642b | 2011-06-27 13:37:22 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef SHILL_CRYPTO_INTERFACE_ |
| 6 | #define SHILL_CRYPTO_INTERFACE_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | namespace shill { |
| 11 | |
| 12 | // An interface to an encryption/decryption module. |
| 13 | class CryptoInterface { |
| 14 | public: |
| 15 | virtual ~CryptoInterface() {} |
| 16 | |
| 17 | // Returns a unique identifier for this crypto module. |
| 18 | virtual std::string GetID() = 0; |
| 19 | |
| 20 | // Encrypts |plaintext| into |ciphertext|. Returns true on success. |
| 21 | virtual bool Encrypt(const std::string &plaintext, |
| 22 | std::string *ciphertext) = 0; |
| 23 | |
| 24 | // Decrypts |ciphertext| into |plaintext|. Returns true on success. |
| 25 | virtual bool Decrypt(const std::string &ciphertext, |
| 26 | std::string *plaintext) = 0; |
| 27 | }; |
| 28 | |
| 29 | } // namespace shill |
| 30 | |
| 31 | #endif // SHILL_CRYPTO_INTERFACE_ |