Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / net / cert / internal / signature_policy.cc
blob69f22f78a9945743b584558ff334ce41bb54c535
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/cert/internal/signature_policy.h"
7 #include "base/logging.h"
9 #if defined(USE_OPENSSL)
10 #include <openssl/obj.h>
11 #endif
13 namespace net {
15 bool SignaturePolicy::IsAcceptableSignatureAlgorithm(
16 const SignatureAlgorithm& algorithm) const {
17 return true;
20 bool SignaturePolicy::IsAcceptableCurveForEcdsa(int curve_nid) const {
21 #if defined(USE_OPENSSL)
22 switch (curve_nid) {
23 case NID_X9_62_prime256v1:
24 case NID_secp384r1:
25 case NID_secp521r1:
26 return true;
28 #endif
29 return false;
32 bool SignaturePolicy::IsAcceptableModulusLengthForRsa(
33 size_t modulus_length_bits) const {
34 return modulus_length_bits >= 2048;
37 SimpleSignaturePolicy::SimpleSignaturePolicy(size_t min_rsa_modulus_length_bits)
38 : min_rsa_modulus_length_bits_(min_rsa_modulus_length_bits) {}
40 bool SimpleSignaturePolicy::IsAcceptableModulusLengthForRsa(
41 size_t modulus_length_bits) const {
42 return modulus_length_bits >= min_rsa_modulus_length_bits_;
45 } // namespace net