• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Chromium Authors
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 NET_EXTRAS_SQLITE_COOKIE_CRYPTO_DELEGATE_H_
6 #define NET_EXTRAS_SQLITE_COOKIE_CRYPTO_DELEGATE_H_
7 
8 #include "base/component_export.h"
9 
10 namespace net {
11 
12 // Implements encryption and decryption for the persistent cookie store.
COMPONENT_EXPORT(NET_EXTRAS)13 class COMPONENT_EXPORT(NET_EXTRAS) CookieCryptoDelegate {
14  public:
15   virtual ~CookieCryptoDelegate() = default;
16 
17   // Return if cookies should be encrypted on this platform.  Decryption of
18   // previously encrypted cookies is always possible.
19   virtual bool ShouldEncrypt() = 0;
20 
21   // Encrypt |plaintext| string and store the result in |ciphertext|.  This
22   // method is always functional even if ShouldEncrypt() is false.
23   virtual bool EncryptString(const std::string& plaintext,
24                              std::string* ciphertext) = 0;
25 
26   // Decrypt |ciphertext| string and store the result in |plaintext|.  This
27   // method is always functional even if ShouldEncrypt() is false.
28   virtual bool DecryptString(const std::string& ciphertext,
29                              std::string* plaintext) = 0;
30 };
31 
32 }  // namespace net
33 
34 #endif  // NET_EXTRAS_SQLITE_COOKIE_CRYPTO_DELEGATE_H_
35