Index: components/gcm_driver/crypto/gcm_encryption_provider.cc |
diff --git a/components/gcm_driver/crypto/gcm_encryption_provider.cc b/components/gcm_driver/crypto/gcm_encryption_provider.cc |
index b869deeb0ac4707e065c38691d03007af83060f7..5e76ac1e9d9c8276054e1a0a2b5565be97a9a123 100644 |
--- a/components/gcm_driver/crypto/gcm_encryption_provider.cc |
+++ b/components/gcm_driver/crypto/gcm_encryption_provider.cc |
@@ -29,6 +29,27 @@ const base::FilePath::CharType kEncryptionDirectoryName[] = |
} // namespace |
+std::string GCMEncryptionProvider::ToDecryptionFailureDetailsString( |
+ DecryptionFailure reason) { |
+ switch(reason) { |
+ case DECRYPTION_FAILURE_UNKNOWN: |
+ return "Unknown failure"; |
+ case DECRYPTION_FAILURE_INVALID_ENCRYPTION_HEADER: |
+ return "Invalid format for the Encryption header"; |
+ case DECRYPTION_FAILURE_INVALID_CRYPTO_KEY_HEADER: |
+ return "Invalid format for the Crypto-Key header"; |
+ case DECRYPTION_FAILURE_NO_KEYS: |
+ return "There are no associated keys with the subscription"; |
+ case DECRYPTION_FAILURE_INVALID_PUBLIC_KEY: |
+ return "The public key in the Crypto-Key header is invalid"; |
+ case DECRYPTION_FAILURE_INVALID_PAYLOAD: |
+ return "AES-GCM decryption failed"; |
+ } |
+ |
+ NOTREACHED(); |
+ return "(invalid reason)"; |
+} |
+ |
GCMEncryptionProvider::GCMEncryptionProvider() |
: weak_ptr_factory_(this) { |
} |