Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp

Issue 7338011: Linux Cert manager: improve PKCS #12 import error messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/net_error_list.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp
diff --git a/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp b/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp
index e3146609f2d3613b2908ed533b17f12fbf44dde6..d65990025eeaf9ea43016f1f7eddbf112e195fc1 100644
--- a/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp
+++ b/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp
@@ -228,13 +228,30 @@ finish:
// We should use that error code instead of inventing a new one
// for every error possible.
if (srv != SECSuccess) {
- if (SEC_ERROR_BAD_PASSWORD == PORT_GetError()) {
- import_result = net::ERR_PKCS12_IMPORT_BAD_PASSWORD;
- }
- else
- {
- LOG(ERROR) << "PKCS#12 import failed with error " << PORT_GetError();
- import_result = net::ERR_PKCS12_IMPORT_FAILED;
+ int error = PORT_GetError();
+ LOG(ERROR) << "PKCS#12 import failed with error " << error;
+ switch (error) {
+ case SEC_ERROR_BAD_PASSWORD:
+ case SEC_ERROR_PKCS12_PRIVACY_PASSWORD_INCORRECT:
+ import_result = net::ERR_PKCS12_IMPORT_BAD_PASSWORD;
+ break;
+ case SEC_ERROR_PKCS12_INVALID_MAC:
+ import_result = net::ERR_PKCS12_IMPORT_INVALID_MAC;
+ break;
+ case SEC_ERROR_BAD_DER:
+ case SEC_ERROR_PKCS12_DECODING_PFX:
+ case SEC_ERROR_PKCS12_CORRUPT_PFX_STRUCTURE:
+ import_result = net::ERR_PKCS12_IMPORT_INVALID_FILE;
+ break;
+ case SEC_ERROR_PKCS12_UNSUPPORTED_MAC_ALGORITHM:
+ case SEC_ERROR_PKCS12_UNSUPPORTED_TRANSPORT_MODE:
+ case SEC_ERROR_PKCS12_UNSUPPORTED_PBE_ALGORITHM:
+ case SEC_ERROR_PKCS12_UNSUPPORTED_VERSION:
+ import_result = net::ERR_PKCS12_IMPORT_UNSUPPORTED;
+ break;
+ default:
+ import_result = net::ERR_PKCS12_IMPORT_FAILED;
+ break;
}
}
// Finish the decoder
« no previous file with comments | « net/base/net_error_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698