| 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 CertErrors; |
| 18 class SignatureAlgorithm; | 19 class SignatureAlgorithm; |
| 19 class SignaturePolicy; | 20 class SignaturePolicy; |
| 20 | 21 |
| 21 // Verifies that |signature_value| is a valid signature of |signed_data| using | 22 // Verifies that |signature_value| is a valid signature of |signed_data| using |
| 22 // the algorithm |signature_algorithm| and the public key |public_key|. | 23 // the algorithm |signature_algorithm| and the public key |public_key|. |
| 23 // | 24 // |
| 24 // |signature_algorithm| - The parsed AlgorithmIdentifier | 25 // |signature_algorithm| - The parsed AlgorithmIdentifier |
| 25 // |signed_data| - The blob of data to verify | 26 // |signed_data| - The blob of data to verify |
| 26 // |signature_value| - The BIT STRING for the signature's value | 27 // |signature_value| - The BIT STRING for the signature's value |
| 27 // |public_key| - A DER-encoded SubjectPublicKeyInfo. | 28 // |public_key| - A DER-encoded SubjectPublicKeyInfo. |
| 28 // |policy| - Instance of the policy to use. This will be queried to | 29 // |policy| - Instance of the policy to use. This will be queried to |
| 29 // determine if: | 30 // determine if: |
| 30 // * The parsed RSA key is an adequate size. | 31 // * The parsed RSA key is an adequate size. |
| 31 // * The parsed EC key is for an allowed curve. | 32 // * The parsed EC key is for an allowed curve. |
| 32 // * The signature algorithm and its parameters are acceptable. | 33 // * The signature algorithm and its parameters are acceptable. |
| 34 // |errors| - Non-null destination for errors/warnings information. |
| 33 // | 35 // |
| 34 // Returns true if verification was successful. | 36 // Returns true if verification was successful. |
| 35 NET_EXPORT bool VerifySignedData(const SignatureAlgorithm& signature_algorithm, | 37 NET_EXPORT bool VerifySignedData(const SignatureAlgorithm& signature_algorithm, |
| 36 const der::Input& signed_data, | 38 const der::Input& signed_data, |
| 37 const der::BitString& signature_value, | 39 const der::BitString& signature_value, |
| 38 const der::Input& public_key, | 40 const der::Input& public_key, |
| 39 const SignaturePolicy* policy) | 41 const SignaturePolicy* policy, |
| 40 WARN_UNUSED_RESULT; | 42 CertErrors* errors) WARN_UNUSED_RESULT; |
| 41 | 43 |
| 42 } // namespace net | 44 } // namespace net |
| 43 | 45 |
| 44 #endif // NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_ | 46 #endif // NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_ |
| OLD | NEW |