| 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 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // The shared secret cannot be derived from the keying material. | 52 // The shared secret cannot be derived from the keying material. |
| 53 DECRYPTION_RESULT_INVALID_SHARED_SECRET = 5, | 53 DECRYPTION_RESULT_INVALID_SHARED_SECRET = 5, |
| 54 | 54 |
| 55 // The payload could not be decrypted as AES-128-GCM. | 55 // The payload could not be decrypted as AES-128-GCM. |
| 56 DECRYPTION_RESULT_INVALID_PAYLOAD = 6, | 56 DECRYPTION_RESULT_INVALID_PAYLOAD = 6, |
| 57 | 57 |
| 58 DECRYPTION_RESULT_LAST = DECRYPTION_RESULT_INVALID_PAYLOAD | 58 DECRYPTION_RESULT_LAST = DECRYPTION_RESULT_INVALID_PAYLOAD |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 // Callback to be invoked when the public key and auth secret are available. | 61 // Callback to be invoked when the public key and auth secret are available. |
| 62 using EncryptionInfoCallback = base::Callback<void(const std::string&, | 62 using EncryptionInfoCallback = |
| 63 const std::string&)>; | 63 base::Callback<void(const std::string& p256dh, |
| 64 const std::string& auth_secret)>; |
| 64 | 65 |
| 65 // Callback to be invoked when a message may have been decrypted, as indicated | 66 // Callback to be invoked when a message may have been decrypted, as indicated |
| 66 // by the |result|. The |message| contains the dispatchable message in success | 67 // by the |result|. The |message| contains the dispatchable message in success |
| 67 // cases, or will be initialized to an empty, default state for failure. | 68 // cases, or will be initialized to an empty, default state for failure. |
| 68 using MessageCallback = base::Callback<void(DecryptionResult result, | 69 using MessageCallback = base::Callback<void(DecryptionResult result, |
| 69 const IncomingMessage& message)>; | 70 const IncomingMessage& message)>; |
| 70 | 71 |
| 71 // Converts |result| to a string describing the details of said result. | 72 // Converts |result| to a string describing the details of said result. |
| 72 static std::string ToDecryptionResultDetailsString(DecryptionResult result); | 73 static std::string ToDecryptionResultDetailsString(DecryptionResult result); |
| 73 | 74 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 std::unique_ptr<GCMKeyStore> key_store_; | 137 std::unique_ptr<GCMKeyStore> key_store_; |
| 137 | 138 |
| 138 base::WeakPtrFactory<GCMEncryptionProvider> weak_ptr_factory_; | 139 base::WeakPtrFactory<GCMEncryptionProvider> weak_ptr_factory_; |
| 139 | 140 |
| 140 DISALLOW_COPY_AND_ASSIGN(GCMEncryptionProvider); | 141 DISALLOW_COPY_AND_ASSIGN(GCMEncryptionProvider); |
| 141 }; | 142 }; |
| 142 | 143 |
| 143 } // namespace gcm | 144 } // namespace gcm |
| 144 | 145 |
| 145 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ | 146 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ |
| OLD | NEW |