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

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: Expand a comment some more... 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') | no next file with comments »
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..6ea832ce9060d470bf59be1c2f649d1396fdbbe7
--- /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 {
Ryan Sleevi 2015/06/29 16:36:29 DESIGN: It seems weird to have a structure with en
eroman 2015/06/29 17:05:06 I will switch this to a full blown class.
+ // Assigns the SignatureAlgorithm by parsing a DER-encoded
+ // "AlgorithmIdentifier" (RFC 5280).
+ //
+ // Returns true on success.
+ bool AssignFromDer(const der::Input& signature_algorithm) WARN_UNUSED_RESULT;
+
+ // Returns true if |*this| is equivalent to |other|.
+ bool Equals(const SignatureAlgorithm& other) const WARN_UNUSED_RESULT;
+
+ SignatureAlgorithmId algorithm;
+ DigestAlgorithmId digest;
+
+ // TODO(eroman): Add support for RSASSA-PSS.
Ryan Sleevi 2015/06/29 16:36:29 Is the idea being that you'll support RSASSA-PSS v
eroman 2015/06/29 17:05:06 Let me go ahead and add RSASSA-PSS support to this
+};
+
+} // namespace net
+
+#endif // NET_CERT_INTERNAL_SIGNATURE_ALGORITHM_H_
« no previous file with comments | « no previous file | net/cert/internal/signature_algorithm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698