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. 4 5 #ifndef NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_ 6 #define NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_ 7 8 #include "base/compiler_specific.h" 9 #include "crypto/openssl_util.h" 10 #include "net/base/net_export.h" 11 #include "third_party/boringssl/src/include/openssl/evp.h" 12 13 namespace net { 14 15 namespace der { 16 class BitString; 17 class Input; 18 } // namespace der 19 20 class SignatureAlgorithm; 21 22 // Verifies that |signature_value| is a valid signature of |signed_data| using 23 // the algorithm |algorithm| and the public key |public_key|. 24 // 25 // |algorithm| - The parsed AlgorithmIdentifier 26 // |signed_data| - The blob of data to verify 27 // |signature_value| - The BIT STRING for the signature's value 28 // |public_key| - The parsed (non-null) public key. 29 // 30 // Returns true if verification was successful. 31 NET_EXPORT bool VerifySignedData(const SignatureAlgorithm& algorithm, 32 const der::Input& signed_data, 33 const der::BitString& signature_value, 34 EVP_PKEY* public_key) WARN_UNUSED_RESULT; 35 36 // Same as above overload, only the public key is inputted as an SPKI and will 37 // be parsed internally. 38 NET_EXPORT bool VerifySignedData(const SignatureAlgorithm& algorithm, 39 const der::Input& signed_data, 40 const der::BitString& signature_value, 41 const der::Input& public_key_spki) 42 WARN_UNUSED_RESULT; 43 44 NET_EXPORT bool ParsePublicKey(const der::Input& public_key_spki, 45 bssl::UniquePtr<EVP_PKEY>* public_key) 46 WARN_UNUSED_RESULT; 47 48 } // namespace net 49 50 #endif // NET_CERT_INTERNAL_VERIFY_SIGNED_DATA_H_ 51