| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/cert/ct_log_verifier.h" | 5 #include "net/cert/ct_log_verifier.h" |
| 6 | 6 |
| 7 #include <cryptohi.h> | 7 #include <cryptohi.h> |
| 8 #include <keyhi.h> | 8 #include <keyhi.h> |
| 9 #include <nss.h> | 9 #include <nss.h> |
| 10 #include <pk11pub.h> | 10 #include <pk11pub.h> |
| 11 #include <secitem.h> | 11 #include <secitem.h> |
| 12 #include <secoid.h> | 12 #include <secoid.h> |
| 13 | 13 |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "crypto/nss_util.h" | 15 #include "crypto/nss_util.h" |
| 16 #include "crypto/sha2.h" | 16 #include "crypto/sha2.h" |
| 17 #include "net/cert/signed_certificate_timestamp.h" | 17 #include "net/cert/signed_tree_head.h" |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 SECOidTag GetNSSSigAlg(ct::DigitallySigned::SignatureAlgorithm alg) { | 23 SECOidTag GetNSSSigAlg(ct::DigitallySigned::SignatureAlgorithm alg) { |
| 24 switch (alg) { | 24 switch (alg) { |
| 25 case ct::DigitallySigned::SIG_ALGO_RSA: | 25 case ct::DigitallySigned::SIG_ALGO_RSA: |
| 26 return SEC_OID_PKCS1_RSA_ENCRYPTION; | 26 return SEC_OID_PKCS1_RSA_ENCRYPTION; |
| 27 case ct::DigitallySigned::SIG_ALGO_DSA: | 27 case ct::DigitallySigned::SIG_ALGO_DSA: |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 SECStatus rv = VFY_VerifyDataDirect( | 133 SECStatus rv = VFY_VerifyDataDirect( |
| 134 reinterpret_cast<const unsigned char*>(data_to_sign.data()), | 134 reinterpret_cast<const unsigned char*>(data_to_sign.data()), |
| 135 data_to_sign.size(), public_key_, &sig_data, | 135 data_to_sign.size(), public_key_, &sig_data, |
| 136 GetNSSSigAlg(signature_algorithm_), GetNSSHashAlg(hash_algorithm_), | 136 GetNSSSigAlg(signature_algorithm_), GetNSSHashAlg(hash_algorithm_), |
| 137 NULL, NULL); | 137 NULL, NULL); |
| 138 DVLOG(1) << "Signature verification result: " << (rv == SECSuccess); | 138 DVLOG(1) << "Signature verification result: " << (rv == SECSuccess); |
| 139 return rv == SECSuccess; | 139 return rv == SECSuccess; |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace net | 142 } // namespace net |
| OLD | NEW |