| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ |
| 6 #define COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ | 6 #define COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // The public key provided in the Crypto-Key header is invalid. | 51 // The public key provided in the Crypto-Key header is invalid. |
| 52 DECRYPTION_FAILURE_INVALID_PUBLIC_KEY, | 52 DECRYPTION_FAILURE_INVALID_PUBLIC_KEY, |
| 53 | 53 |
| 54 // The payload could not be decrypted as AES-128-GCM. | 54 // The payload could not be decrypted as AES-128-GCM. |
| 55 DECRYPTION_FAILURE_INVALID_PAYLOAD | 55 DECRYPTION_FAILURE_INVALID_PAYLOAD |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // Callback to be invoked when a message cannot be decoded. | 58 // Callback to be invoked when a message cannot be decoded. |
| 59 using DecryptionFailedCallback = base::Callback<void(DecryptionFailure)>; | 59 using DecryptionFailedCallback = base::Callback<void(DecryptionFailure)>; |
| 60 | 60 |
| 61 // Converts |reason| to a string describing the details of said reason. |
| 62 static std::string ToDecryptionFailureDetailsString(DecryptionFailure reason); |
| 63 |
| 61 GCMEncryptionProvider(); | 64 GCMEncryptionProvider(); |
| 62 ~GCMEncryptionProvider(); | 65 ~GCMEncryptionProvider(); |
| 63 | 66 |
| 64 // Initializes the encryption provider with the |store_path| and the | 67 // Initializes the encryption provider with the |store_path| and the |
| 65 // |blocking_task_runner|. Done separately from the constructor in order to | 68 // |blocking_task_runner|. Done separately from the constructor in order to |
| 66 // avoid needing a blocking task runner for anything using GCMDriver. | 69 // avoid needing a blocking task runner for anything using GCMDriver. |
| 67 void Init( | 70 void Init( |
| 68 const base::FilePath& store_path, | 71 const base::FilePath& store_path, |
| 69 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); | 72 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); |
| 70 | 73 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 scoped_ptr<GCMKeyStore> key_store_; | 112 scoped_ptr<GCMKeyStore> key_store_; |
| 110 | 113 |
| 111 base::WeakPtrFactory<GCMEncryptionProvider> weak_ptr_factory_; | 114 base::WeakPtrFactory<GCMEncryptionProvider> weak_ptr_factory_; |
| 112 | 115 |
| 113 DISALLOW_COPY_AND_ASSIGN(GCMEncryptionProvider); | 116 DISALLOW_COPY_AND_ASSIGN(GCMEncryptionProvider); |
| 114 }; | 117 }; |
| 115 | 118 |
| 116 } // namespace gcm | 119 } // namespace gcm |
| 117 | 120 |
| 118 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ | 121 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ |
| OLD | NEW |