| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_CERT_INTERNAL_SIGNATURE_ALGORITHM_H_ | 5 #ifndef NET_CERT_INTERNAL_SIGNATURE_ALGORITHM_H_ |
| 6 #define NET_CERT_INTERNAL_SIGNATURE_ALGORITHM_H_ | 6 #define NET_CERT_INTERNAL_SIGNATURE_ALGORITHM_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // The signature scheme used within a signature. Parameters are specified | 29 // The signature scheme used within a signature. Parameters are specified |
| 30 // separately. | 30 // separately. |
| 31 enum class SignatureAlgorithmId { | 31 enum class SignatureAlgorithmId { |
| 32 RsaPkcs1, // RSA PKCS#1 v1.5 | 32 RsaPkcs1, // RSA PKCS#1 v1.5 |
| 33 RsaPss, // RSASSA-PSS | 33 RsaPss, // RSASSA-PSS |
| 34 Ecdsa, // ECDSA | 34 Ecdsa, // ECDSA |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 // Parses a HashAlgorithm as defined by RFC 5912: |
| 38 // |
| 39 // HashAlgorithm ::= AlgorithmIdentifier{DIGEST-ALGORITHM, |
| 40 // {HashAlgorithms}} |
| 41 // |
| 42 // HashAlgorithms DIGEST-ALGORITHM ::= { |
| 43 // { IDENTIFIER id-sha1 PARAMS TYPE NULL ARE preferredPresent } | |
| 44 // { IDENTIFIER id-sha224 PARAMS TYPE NULL ARE preferredPresent } | |
| 45 // { IDENTIFIER id-sha256 PARAMS TYPE NULL ARE preferredPresent } | |
| 46 // { IDENTIFIER id-sha384 PARAMS TYPE NULL ARE preferredPresent } | |
| 47 // { IDENTIFIER id-sha512 PARAMS TYPE NULL ARE preferredPresent } |
| 48 // } |
| 49 WARN_UNUSED_RESULT bool ParseHashAlgorithm(const der::Input input, |
| 50 DigestAlgorithm* out); |
| 51 |
| 37 // Base class for describing algorithm parameters. | 52 // Base class for describing algorithm parameters. |
| 38 class NET_EXPORT SignatureAlgorithmParameters { | 53 class NET_EXPORT SignatureAlgorithmParameters { |
| 39 public: | 54 public: |
| 40 SignatureAlgorithmParameters() {} | 55 SignatureAlgorithmParameters() {} |
| 41 virtual ~SignatureAlgorithmParameters(){}; | 56 virtual ~SignatureAlgorithmParameters(){}; |
| 42 | 57 |
| 43 private: | 58 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(SignatureAlgorithmParameters); | 59 DISALLOW_COPY_AND_ASSIGN(SignatureAlgorithmParameters); |
| 45 }; | 60 }; |
| 46 | 61 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 const SignatureAlgorithmId algorithm_; | 114 const SignatureAlgorithmId algorithm_; |
| 100 const DigestAlgorithm digest_; | 115 const DigestAlgorithm digest_; |
| 101 const scoped_ptr<SignatureAlgorithmParameters> params_; | 116 const scoped_ptr<SignatureAlgorithmParameters> params_; |
| 102 | 117 |
| 103 DISALLOW_COPY_AND_ASSIGN(SignatureAlgorithm); | 118 DISALLOW_COPY_AND_ASSIGN(SignatureAlgorithm); |
| 104 }; | 119 }; |
| 105 | 120 |
| 106 } // namespace net | 121 } // namespace net |
| 107 | 122 |
| 108 #endif // NET_CERT_INTERNAL_SIGNATURE_ALGORITHM_H_ | 123 #endif // NET_CERT_INTERNAL_SIGNATURE_ALGORITHM_H_ |
| OLD | NEW |