Index: net/cert/internal/signature_policy.cc |
diff --git a/net/cert/internal/signature_policy.cc b/net/cert/internal/signature_policy.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..69f22f78a9945743b584558ff334ce41bb54c535 |
--- /dev/null |
+++ b/net/cert/internal/signature_policy.cc |
@@ -0,0 +1,45 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "net/cert/internal/signature_policy.h" |
+ |
+#include "base/logging.h" |
+ |
+#if defined(USE_OPENSSL) |
+#include <openssl/obj.h> |
+#endif |
+ |
+namespace net { |
+ |
+bool SignaturePolicy::IsAcceptableSignatureAlgorithm( |
+ const SignatureAlgorithm& algorithm) const { |
+ return true; |
+} |
+ |
+bool SignaturePolicy::IsAcceptableCurveForEcdsa(int curve_nid) const { |
+#if defined(USE_OPENSSL) |
+ switch (curve_nid) { |
+ case NID_X9_62_prime256v1: |
+ case NID_secp384r1: |
+ case NID_secp521r1: |
+ return true; |
+ } |
+#endif |
+ return false; |
+} |
+ |
+bool SignaturePolicy::IsAcceptableModulusLengthForRsa( |
+ size_t modulus_length_bits) const { |
+ return modulus_length_bits >= 2048; |
+} |
+ |
+SimpleSignaturePolicy::SimpleSignaturePolicy(size_t min_rsa_modulus_length_bits) |
+ : min_rsa_modulus_length_bits_(min_rsa_modulus_length_bits) {} |
+ |
+bool SimpleSignaturePolicy::IsAcceptableModulusLengthForRsa( |
+ size_t modulus_length_bits) const { |
+ return modulus_length_bits >= min_rsa_modulus_length_bits_; |
+} |
+ |
+} // namespace net |