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

Unified Diff: net/cert/internal/signature_algorithm.h

Issue 1218753002: Add DER parsing of AlgorithmId for signatures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove clang-format off and just accept its formatting Created 5 years, 6 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 | « no previous file | net/cert/internal/signature_algorithm.cc » ('j') | net/cert/internal/signature_algorithm.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/signature_algorithm.h
diff --git a/net/cert/internal/signature_algorithm.h b/net/cert/internal/signature_algorithm.h
new file mode 100644
index 0000000000000000000000000000000000000000..d5d8eff9d4911f27197d529078a3b2b50a2731af
--- /dev/null
+++ b/net/cert/internal/signature_algorithm.h
@@ -0,0 +1,49 @@
+// 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.
+
+#ifndef NET_CERT_INTERNAL_SIGNATURE_ALGORITHM_H_
+#define NET_CERT_INTERNAL_SIGNATURE_ALGORITHM_H_
+
+#include "base/compiler_specific.h"
+#include "net/base/net_export.h"
+
+namespace net {
+
+namespace der {
+class Input;
+}
+
+enum class SignatureAlgorithmId {
+ RsaPkcs1_5,
+ Ecdsa,
+};
+
+enum class DigestAlgorithmId {
+ Sha1,
+ Sha256,
+ Sha384,
+ Sha512,
+};
+
+// SignatureAlgorithm describes a signature algorithm and its parameters. This
+// corresponds to "AlgorithmIdentifier" from RFC 5280.
+struct NET_EXPORT SignatureAlgorithm {
+ // Assigns the SignatureAlgorithm by parsing a DER-encoded
+ // "AlgorithmIdentifier" (RFC 5280).
+ //
+ // Returns true on success.
+ WARN_UNUSED_RESULT bool AssignFromDer(const der::Input& signature_algorithm);
Ryan Sleevi 2015/06/29 14:45:24 WARN_UNUSED_RESULT historically goes on the end of
+
+ // Returns true if |*this| is equivalent to |other|.
+ WARN_UNUSED_RESULT bool Equals(const SignatureAlgorithm& other) const;
Ryan Sleevi 2015/06/29 14:45:24 Ditto
+
+ SignatureAlgorithmId algorithm;
+ DigestAlgorithmId digest;
+
+ // TODO(eroman): Add support for RSASSA-PSS.
+};
+
+} // namespace net
+
+#endif // NET_CERT_INTERNAL_SIGNATURE_ALGORITHM_H_
« no previous file with comments | « no previous file | net/cert/internal/signature_algorithm.cc » ('j') | net/cert/internal/signature_algorithm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698