1 // Copyright 2014 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_SHA256_LEGACY_SUPPORT_WIN_H_
6 #define NET_CERT_SHA256_LEGACY_SUPPORT_WIN_H_
10 #include "base/strings/string_piece.h"
11 #include "crypto/wincrypt_shim.h"
12 #include "net/base/net_export.h"
16 namespace sha256_interception {
18 typedef BOOL (WINAPI* CryptVerifyCertificateSignatureExFunc)(
19 HCRYPTPROV_LEGACY provider,
28 // Interception function meant to be called whenever
29 // CryptVerifyCertificateSignatureEx is called. Note that the calling
30 // conventions do not match, as the caller is expected to ensure that their
31 // interposed function handles the calling conventions and provides a pointer
32 // to the original CryptVerifyCertificateSignatureEx (e.g. to handle parameters
33 // and keys that are not supported).
34 NET_EXPORT BOOL CryptVerifyCertificateSignatureExHook(
35 CryptVerifyCertificateSignatureExFunc original_func,
36 HCRYPTPROV_LEGACY provider,
45 // Returns true if |subject_type| a supported subject type for interception.
46 bool IsSupportedSubjectType(DWORD subject_type);
48 // Returns true if |issuer_type| is a supported issuer type for interception.
49 bool IsSupportedIssuerType(DWORD issuer_type);
51 // Returns the encoded form of |subject_data| or an empty StringPiece if not
53 base::StringPiece GetSubjectSignature(DWORD subject_type,
56 // Returns the public key of |issuer_data| or NULL if not supported.
57 PCERT_PUBLIC_KEY_INFO GetIssuerPublicKey(DWORD issuer_type,
60 } // namespace sha256_interception
64 #endif // NET_CERT_SHA256_LEGACY_SUPPORT_WIN_H_