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

Side by Side Diff: net/cert/internal/signature_policy.cc

Issue 1259313002: Add some policy controls for VerifySignedData(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_python
Patch Set: Address Ryan's comments Created 5 years, 4 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "net/cert/internal/signature_policy.h"
6
7 #include "base/logging.h"
8
9 // TODO(eroman): There is no intention to implement this for non-OpenSSL. Remove
10 // this branch once the migration is complete. This could have been done as a
11 // conditional file (_openssl.cc) in the build file instead, but that is likely
12 // not worth the effort at this point.
13
14 #if defined(USE_OPENSSL)
15 #include <openssl/obj_mac.h>
16 #endif
17
18 namespace net {
19
20 bool SignaturePolicy::IsAcceptableSignatureAlgorithm(
21 const SignatureAlgorithm& algorithm) const {
22 return true;
23 }
24
25 bool SignaturePolicy::IsAcceptableCurveForEcdsa(int curve_nid) const {
26 #if defined(USE_OPENSSL)
27 switch (curve_nid) {
28 case NID_X9_62_prime256v1:
29 case NID_secp384r1:
30 case NID_secp521r1:
31 return true;
32 }
33 #endif
34 return false;
35 }
36
37 bool SignaturePolicy::IsAcceptableModulusLengthForRsa(
38 size_t modulus_length_bits) const {
39 return modulus_length_bits >= 2048;
40 }
41
42 SimpleSignaturePolicy::SimpleSignaturePolicy(size_t min_rsa_modulus_length_bits)
43 : min_rsa_modulus_length_bits_(min_rsa_modulus_length_bits) {}
44
45 bool SimpleSignaturePolicy::IsAcceptableModulusLengthForRsa(
46 size_t modulus_length_bits) const {
47 return modulus_length_bits >= min_rsa_modulus_length_bits_;
48 }
49
50 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698