| 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_VERIFY_SIGNED_DATA_H_ | 5 #ifndef NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_ |
| 6 #define NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_ | 6 #define NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "net/base/net_export.h" | 9 #include "net/base/net_export.h" |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 | 12 |
| 13 namespace der { | 13 namespace der { |
| 14 class BitString; | 14 class BitString; |
| 15 class Input; | 15 class Input; |
| 16 } // namespace der | 16 } // namespace der |
| 17 | 17 |
| 18 class SignatureAlgorithm; | 18 class SignatureAlgorithm; |
| 19 class SignaturePolicy; |
| 19 | 20 |
| 20 // Verifies that |signature_value| is a valid signature of |signed_data| using | 21 // Verifies that |signature_value| is a valid signature of |signed_data| using |
| 21 // the algorithm |signature_algorithm| and the public key |public_key|. | 22 // the algorithm |signature_algorithm| and the public key |public_key|. |
| 22 // | 23 // |
| 23 // |signature_algorithm| - The parsed AlgorithmIdentifier | 24 // |signature_algorithm| - The parsed AlgorithmIdentifier |
| 24 // |signed_data| - The blob of data to verify | 25 // |signed_data| - The blob of data to verify |
| 25 // |signature_value| - The BIT STRING for the signature's value | 26 // |signature_value| - The BIT STRING for the signature's value |
| 26 // |public_key| - A DER-encoded SubjectPublicKeyInfo. | 27 // |public_key| - A DER-encoded SubjectPublicKeyInfo. |
| 28 // |policy| - Instance of the policy to use. This will be queried to |
| 29 // determine if: |
| 30 // * The parsed RSA key is an adequate size. |
| 31 // * The parsed EC key is for an allowed curve. |
| 32 // * The signature algorithm and its parameters are acceptable. |
| 27 // | 33 // |
| 28 // Returns true if verification was successful. | 34 // Returns true if verification was successful. |
| 29 NET_EXPORT bool VerifySignedData(const SignatureAlgorithm& signature_algorithm, | 35 NET_EXPORT bool VerifySignedData(const SignatureAlgorithm& signature_algorithm, |
| 30 const der::Input& signed_data, | 36 const der::Input& signed_data, |
| 31 const der::BitString& signature_value, | 37 const der::BitString& signature_value, |
| 32 const der::Input& public_key) | 38 const der::Input& public_key, |
| 39 const SignaturePolicy* policy) |
| 33 WARN_UNUSED_RESULT; | 40 WARN_UNUSED_RESULT; |
| 34 | 41 |
| 35 } // namespace net | 42 } // namespace net |
| 36 | 43 |
| 37 #endif // NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_ | 44 #endif // NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_ |
| OLD | NEW |