Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / net / cert / internal / verify_signed_data.h
blob97c150dffba27c887d830f764c69d57d0581e98a
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
3 // found in the LICENSE file.
5 #ifndef NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_
6 #define NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_
8 #include "base/compiler_specific.h"
9 #include "net/base/net_export.h"
11 namespace net {
13 namespace der {
14 class BitString;
15 class Input;
16 } // namespace der
18 class SignatureAlgorithm;
19 class SignaturePolicy;
21 // Verifies that |signature_value| is a valid signature of |signed_data| using
22 // the algorithm |signature_algorithm| and the public key |public_key|.
24 // |signature_algorithm| - The parsed AlgorithmIdentifier
25 // |signed_data| - The blob of data to verify
26 // |signature_value| - The BIT STRING for the signature's value
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.
34 // Returns true if verification was successful.
35 NET_EXPORT bool VerifySignedData(const SignatureAlgorithm& signature_algorithm,
36 const der::Input& signed_data,
37 const der::BitString& signature_value,
38 const der::Input& public_key,
39 const SignaturePolicy* policy)
40 WARN_UNUSED_RESULT;
42 } // namespace net
44 #endif // NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_