OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "net/base/cert_database.h" | 5 #include "net/base/cert_database.h" |
6 | 6 |
7 #include <cert.h> | 7 #include <cert.h> |
8 #include <certdb.h> | 8 #include <certdb.h> |
9 #include <keyhi.h> | 9 #include <keyhi.h> |
10 #include <pk11pub.h> | 10 #include <pk11pub.h> |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 LOG(ERROR) << "CERT_GetCertTrust failed with error " << PORT_GetError(); | 161 LOG(ERROR) << "CERT_GetCertTrust failed with error " << PORT_GetError(); |
162 return UNTRUSTED; | 162 return UNTRUSTED; |
163 } | 163 } |
164 psm::nsNSSCertTrust trust(&nsstrust); | 164 psm::nsNSSCertTrust trust(&nsstrust); |
165 switch (type) { | 165 switch (type) { |
166 case CA_CERT: | 166 case CA_CERT: |
167 return trust.HasTrustedCA(PR_TRUE, PR_FALSE, PR_FALSE) * TRUSTED_SSL + | 167 return trust.HasTrustedCA(PR_TRUE, PR_FALSE, PR_FALSE) * TRUSTED_SSL + |
168 trust.HasTrustedCA(PR_FALSE, PR_TRUE, PR_FALSE) * TRUSTED_EMAIL + | 168 trust.HasTrustedCA(PR_FALSE, PR_TRUE, PR_FALSE) * TRUSTED_EMAIL + |
169 trust.HasTrustedCA(PR_FALSE, PR_FALSE, PR_TRUE) * TRUSTED_OBJ_SIGN; | 169 trust.HasTrustedCA(PR_FALSE, PR_FALSE, PR_TRUE) * TRUSTED_OBJ_SIGN; |
170 case SERVER_CERT: | 170 case SERVER_CERT: |
171 case EMAIL_CERT: | |
172 return trust.HasTrustedPeer(PR_TRUE, PR_FALSE, PR_FALSE) * TRUSTED_SSL + | 171 return trust.HasTrustedPeer(PR_TRUE, PR_FALSE, PR_FALSE) * TRUSTED_SSL + |
173 trust.HasTrustedPeer(PR_FALSE, PR_TRUE, PR_FALSE) * TRUSTED_EMAIL + | 172 trust.HasTrustedPeer(PR_FALSE, PR_TRUE, PR_FALSE) * TRUSTED_EMAIL + |
174 trust.HasTrustedPeer(PR_FALSE, PR_FALSE, PR_TRUE) * TRUSTED_OBJ_SIGN; | 173 trust.HasTrustedPeer(PR_FALSE, PR_FALSE, PR_TRUE) * TRUSTED_OBJ_SIGN; |
175 default: | 174 default: |
176 return UNTRUSTED; | 175 return UNTRUSTED; |
177 } | 176 } |
178 } | 177 } |
179 | 178 |
180 bool CertDatabase::SetCertTrust(const X509Certificate* cert, | 179 bool CertDatabase::SetCertTrust(const X509Certificate* cert, |
181 CertType type, | 180 CertType type, |
(...skipping 22 matching lines...) Expand all Loading... |
204 } | 203 } |
205 return true; | 204 return true; |
206 } | 205 } |
207 | 206 |
208 bool CertDatabase::IsReadOnly(const X509Certificate* cert) const { | 207 bool CertDatabase::IsReadOnly(const X509Certificate* cert) const { |
209 PK11SlotInfo* slot = cert->os_cert_handle()->slot; | 208 PK11SlotInfo* slot = cert->os_cert_handle()->slot; |
210 return slot && PK11_IsReadOnly(slot); | 209 return slot && PK11_IsReadOnly(slot); |
211 } | 210 } |
212 | 211 |
213 } // namespace net | 212 } // namespace net |
OLD | NEW |