summaryrefslogtreecommitdiffstats
path: root/chrome/third_party/mozilla_security_manager
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-04 03:35:51 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-04 03:35:51 +0000
commitefbe3c63f38d26d8fb707a28e17854243fc72f82 (patch)
tree5e1908c6b2fa2da53713363595d22b5773bc6539 /chrome/third_party/mozilla_security_manager
parentce47a3c7f3296d5fb72b2c980377b613c35d4c33 (diff)
downloadchromium_src-efbe3c63f38d26d8fb707a28e17854243fc72f82.zip
chromium_src-efbe3c63f38d26d8fb707a28e17854243fc72f82.tar.gz
chromium_src-efbe3c63f38d26d8fb707a28e17854243fc72f82.tar.bz2
Linux certificate viewer: add decoding of rsa public key.
BUG=18119 TEST=compare to firefox Review URL: http://codereview.chromium.org/669032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/third_party/mozilla_security_manager')
-rw-r--r--chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp24
-rw-r--r--chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp b/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp
index 3c16cf0..5006405 100644
--- a/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp
+++ b/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp
@@ -40,6 +40,7 @@
#include "chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h"
+#include <keyhi.h>
#include <prprf.h>
#include "app/l10n_util.h"
@@ -832,4 +833,27 @@ std::string ProcessExtensionData(SECOidTag oid_tag, SECItem* extension_data) {
}
}
+std::string ProcessSubjectPublicKeyInfo(CERTSubjectPublicKeyInfo* spki) {
+ std::string rv;
+ SECKEYPublicKey* key = SECKEY_ExtractPublicKey(spki);
+ if (key) {
+ switch (key->keyType) {
+ case rsaKey: {
+ rv = l10n_util::GetStringFUTF8(
+ IDS_CERT_RSA_PUBLIC_KEY_DUMP_FORMAT,
+ UintToString16(key->u.rsa.modulus.len * 8),
+ UTF8ToUTF16(ProcessRawBytes(&key->u.rsa.modulus)),
+ UintToString16(key->u.rsa.publicExponent.len * 8),
+ UTF8ToUTF16(ProcessRawBytes(&key->u.rsa.publicExponent)));
+ break;
+ }
+ default:
+ rv = ProcessRawBits(&spki->subjectPublicKey);
+ break;
+ }
+ SECKEY_DestroyPublicKey(key);
+ }
+ return rv;
+}
+
} // namespace mozilla_security_manager
diff --git a/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h b/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h
index 5741c69..eaa6e8b 100644
--- a/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h
+++ b/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h
@@ -92,6 +92,7 @@ std::string ProcessKeyUsageBitString(SECItem* bitstring, char sep);
std::string ProcessKeyUsageExtension(SECItem* extension_data);
std::string ProcessExtKeyUsage(SECItem* extension_data);
std::string ProcessExtensionData(SECOidTag oid_tag, SECItem* extension_data);
+std::string ProcessSubjectPublicKeyInfo(CERTSubjectPublicKeyInfo* spki);
} // namespace mozilla_security_manager