| 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 23 matching lines...) Expand all Loading... |
| 34 // Callback to be invoked when a message has been decrypted. | 34 // Callback to be invoked when a message has been decrypted. |
| 35 using MessageDecryptedCallback = base::Callback<void(const IncomingMessage&)>; | 35 using MessageDecryptedCallback = base::Callback<void(const IncomingMessage&)>; |
| 36 | 36 |
| 37 // Reasons why the decryption of an incoming message can fail. | 37 // Reasons why the decryption of an incoming message can fail. |
| 38 enum DecryptionFailure { | 38 enum DecryptionFailure { |
| 39 DECRYPTION_FAILURE_UNKNOWN, | 39 DECRYPTION_FAILURE_UNKNOWN, |
| 40 | 40 |
| 41 // The contents of the Encryption HTTP header could not be parsed. | 41 // The contents of the Encryption HTTP header could not be parsed. |
| 42 DECRYPTION_FAILURE_INVALID_ENCRYPTION_HEADER, | 42 DECRYPTION_FAILURE_INVALID_ENCRYPTION_HEADER, |
| 43 | 43 |
| 44 // The contents of the Encryption-Key HTTP header could not be parsed. | 44 // The contents of the Crypto-Key HTTP header could not be parsed. |
| 45 DECRYPTION_FAILURE_INVALID_ENCRYPTION_KEY_HEADER, | 45 DECRYPTION_FAILURE_INVALID_CRYPTO_KEY_HEADER, |
| 46 | 46 |
| 47 // No public/private key-pair was associated with the app_id. | 47 // No public/private key-pair was associated with the app_id. |
| 48 DECRYPTION_FAILURE_NO_KEYS, | 48 DECRYPTION_FAILURE_NO_KEYS, |
| 49 | 49 |
| 50 // The public key provided in the Encryption-Key header is invalid. | 50 // The public key provided in the Crypto-Key header is invalid. |
| 51 DECRYPTION_FAILURE_INVALID_PUBLIC_KEY, | 51 DECRYPTION_FAILURE_INVALID_PUBLIC_KEY, |
| 52 | 52 |
| 53 // The payload could not be decrypted as AES-128-GCM. | 53 // The payload could not be decrypted as AES-128-GCM. |
| 54 DECRYPTION_FAILURE_INVALID_PAYLOAD | 54 DECRYPTION_FAILURE_INVALID_PAYLOAD |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // Callback to be invoked when a message cannot be decoded. | 57 // Callback to be invoked when a message cannot be decoded. |
| 58 using DecryptionFailedCallback = base::Callback<void(DecryptionFailure)>; | 58 using DecryptionFailedCallback = base::Callback<void(DecryptionFailure)>; |
| 59 | 59 |
| 60 GCMEncryptionProvider(); | 60 GCMEncryptionProvider(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 scoped_ptr<GCMKeyStore> key_store_; | 105 scoped_ptr<GCMKeyStore> key_store_; |
| 106 | 106 |
| 107 base::WeakPtrFactory<GCMEncryptionProvider> weak_ptr_factory_; | 107 base::WeakPtrFactory<GCMEncryptionProvider> weak_ptr_factory_; |
| 108 | 108 |
| 109 DISALLOW_COPY_AND_ASSIGN(GCMEncryptionProvider); | 109 DISALLOW_COPY_AND_ASSIGN(GCMEncryptionProvider); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 } // namespace gcm | 112 } // namespace gcm |
| 113 | 113 |
| 114 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ | 114 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ |
| OLD | NEW |