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

Unified Diff: chrome/browser/chromeos/options/vpn_config_view.cc

Issue 16946002: Resolve certificate references in ONC by PEM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Support CACert PEM list for L2tp. Created 7 years, 6 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
Index: chrome/browser/chromeos/options/vpn_config_view.cc
diff --git a/chrome/browser/chromeos/options/vpn_config_view.cc b/chrome/browser/chromeos/options/vpn_config_view.cc
index 089474995a7e6fe85b99f78ac6c909136273a4f9..f35536ed4e560e9fed7d279a8ee3b826def8f1c0 100644
--- a/chrome/browser/chromeos/options/vpn_config_view.cc
+++ b/chrome/browser/chromeos/options/vpn_config_view.cc
@@ -313,7 +313,7 @@ bool VPNConfigView::Login() {
config_data.group_name = GetGroupName();
break;
case PROVIDER_TYPE_L2TP_IPSEC_USER_CERT: {
- config_data.server_ca_cert_nss_nickname = GetServerCACertNssNickname();
+ config_data.server_ca_cert_pem = GetServerCACertPEM();
config_data.client_cert_pkcs11_id = GetUserCertID();
config_data.username = GetUsername();
config_data.user_passphrase = GetUserPassphrase();
@@ -321,7 +321,7 @@ bool VPNConfigView::Login() {
break;
}
case PROVIDER_TYPE_OPEN_VPN:
- config_data.server_ca_cert_nss_nickname = GetServerCACertNssNickname();
+ config_data.server_ca_cert_pem = GetServerCACertPEM();
config_data.client_cert_pkcs11_id = GetUserCertID();
config_data.username = GetUsername();
config_data.user_passphrase = GetUserPassphrase();
@@ -421,7 +421,7 @@ const std::string VPNConfigView::GetOTP() const {
return GetTextFromField(otp_textfield_, true);
}
-const std::string VPNConfigView::GetServerCACertNssNickname() const {
+const std::string VPNConfigView::GetServerCACertPEM() const {
int index = server_ca_cert_combobox_ ?
server_ca_cert_combobox_->selected_index() : 0;
if (index == 0) {
@@ -429,7 +429,7 @@ const std::string VPNConfigView::GetServerCACertNssNickname() const {
return std::string();
} else {
int cert_index = index - 1;
- return CertLibrary::Get()->GetCertNicknameAt(
+ return CertLibrary::Get()->GetCertPEMAt(
CertLibrary::CERT_TYPE_SERVER_CA, cert_index);
}
}
@@ -453,14 +453,20 @@ void VPNConfigView::Init(VirtualNetwork* vpn) {
if (vpn) {
ProviderType type = vpn->provider_type();
std::string type_dict_name = ProviderTypeToONCDictKey(type);
- ParseVPNUIProperty(&ca_cert_ui_data_, vpn, type_dict_name,
- onc::vpn::kServerCARef);
- ParseVPNUIProperty(&psk_passphrase_ui_data_, vpn, type_dict_name,
- onc::vpn::kPSK);
+
+ if (type == PROVIDER_TYPE_L2TP_IPSEC_PSK) {
+ ParseVPNUIProperty(&ca_cert_ui_data_, vpn, type_dict_name,
+ onc::ipsec::kServerCARef);
+ ParseVPNUIProperty(&psk_passphrase_ui_data_, vpn, type_dict_name,
+ onc::ipsec::kPSK);
+ ParseVPNUIProperty(&group_name_ui_data_, vpn, type_dict_name,
+ onc::ipsec::kGroup);
+ } else { // OpenVPN
+ ParseVPNUIProperty(&ca_cert_ui_data_, vpn, type_dict_name,
+ onc::openvpn::kServerCARef);
+ }
ParseVPNUIProperty(&user_cert_ui_data_, vpn, type_dict_name,
onc::vpn::kClientCertRef);
- ParseVPNUIProperty(&group_name_ui_data_, vpn, type_dict_name,
- onc::vpn::kGroup);
const std::string credentials_dict_name(
type == PROVIDER_TYPE_L2TP_IPSEC_PSK ?
@@ -718,10 +724,10 @@ void VPNConfigView::Refresh() {
if (server_ca_cert_combobox_) {
server_ca_cert_combobox_->ModelChanged();
if (enable_server_ca_cert_ &&
- (vpn && !vpn->ca_cert_nss().empty())) {
+ (vpn && !vpn->ca_cert_pem().empty())) {
// Select the current server CA certificate in the combobox.
- int cert_index = CertLibrary::Get()->GetCertIndexByNickname(
- CertLibrary::CERT_TYPE_SERVER_CA, vpn->ca_cert_nss());
+ int cert_index = CertLibrary::Get()->GetCertIndexByPEM(
+ CertLibrary::CERT_TYPE_SERVER_CA, vpn->ca_cert_pem());
if (cert_index >= 0) {
// Skip item for "Default"
server_ca_cert_combobox_->SetSelectedIndex(1 + cert_index);

Powered by Google App Engine
This is Rietveld 408576698