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

Unified 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 more 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/internal/signature_policy.h ('k') | net/cert/internal/verify_signed_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/cert/internal/signature_policy.h ('k') | net/cert/internal/verify_signed_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698