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_ |