| Index: components/gcm_driver/crypto/gcm_encryption_provider.h
|
| diff --git a/components/gcm_driver/crypto/gcm_encryption_provider.h b/components/gcm_driver/crypto/gcm_encryption_provider.h
|
| index a395118a1293d9367a2f949af8eab7a5f0f922d5..ce96860651a013792c56a9b7a7400accd61d6c22 100644
|
| --- a/components/gcm_driver/crypto/gcm_encryption_provider.h
|
| +++ b/components/gcm_driver/crypto/gcm_encryption_provider.h
|
| @@ -19,7 +19,10 @@ class SequencedTaskRunner;
|
|
|
| namespace gcm {
|
|
|
| +struct EncryptionHeaderValue;
|
| +struct EncryptionKeyHeaderValue;
|
| class GCMKeyStore;
|
| +struct IncomingMessage;
|
| class KeyPair;
|
|
|
| // Provider that enables the GCM Driver to deal with encryption key management
|
| @@ -29,6 +32,10 @@ class GCMEncryptionProvider {
|
| // Callback to be invoked when the public encryption key is available.
|
| using PublicKeyCallback = base::Callback<void(const std::string&)>;
|
|
|
| + // Callback to be invoked when a message may have been decrypted.
|
| + using MessageCallback =
|
| + base::Callback<void(const IncomingMessage&, bool decryption_successful)>;
|
| +
|
| GCMEncryptionProvider();
|
| ~GCMEncryptionProvider();
|
|
|
| @@ -44,6 +51,15 @@ class GCMEncryptionProvider {
|
| void GetPublicKey(const std::string& app_id,
|
| const PublicKeyCallback& callback);
|
|
|
| + // Determines whether |message| contains encrypted content.
|
| + bool IsEncryptedMessage(const IncomingMessage& message) const;
|
| +
|
| + // Decrypts |message| and stores the result in |decrypted_message|. The return
|
| + // value indicates whether the message could be decrypted successfully.
|
| + void DecryptMessage(const std::string& app_id,
|
| + const IncomingMessage& message,
|
| + const MessageCallback& callback);
|
| +
|
| private:
|
| void DidGetPublicKey(const std::string& app_id,
|
| const PublicKeyCallback& callback,
|
| @@ -52,6 +68,14 @@ class GCMEncryptionProvider {
|
| void DidCreatePublicKey(const PublicKeyCallback& callback,
|
| const KeyPair& pair);
|
|
|
| + void DecryptMessageWithKey(
|
| + const IncomingMessage& message,
|
| + const MessageCallback& callback,
|
| + const EncryptionHeaderValue& encryption_header,
|
| + const EncryptionKeyHeaderValue& encryption_key_header,
|
| + const std::string& ciphertext,
|
| + const KeyPair& pair);
|
| +
|
| scoped_ptr<GCMKeyStore> key_store_;
|
|
|
| base::WeakPtrFactory<GCMEncryptionProvider> weak_ptr_factory_;
|
|
|