Win32 API 日本語リファレンス
ホームSecurity.WinTrust › CRYPT_PROVIDER_CERT

CRYPT_PROVIDER_CERT

構造体
サイズx64: 88 バイト / x86: 60 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
cbStructDWORD4+0+0本構造体のバイトサイズ。
pCertCERT_CONTEXT*8/4+8+4対象の証明書コンテキストへのポインタ。
fCommercialBOOL4+16+8商用証明書かを示すフラグ。
fTrustedRootBOOL4+20+12信頼されたルート証明書かを示すフラグ。
fSelfSignedBOOL4+24+16自己署名証明書かを示すフラグ。
fTestCertBOOL4+28+20テスト証明書かを示すフラグ。
dwRevokedReasonDWORD4+32+24証明書が失効した理由コードを表す。
dwConfidenceDWORD4+36+28証明書の信頼度を示すフラグ群。
dwErrorDWORD4+40+32証明書検証のエラーコードを表す。
pTrustListContextCTL_CONTEXT*8/4+48+36信頼リスト(CTL)コンテキストへのポインタ。
fTrustListSignerCertBOOL4+56+40信頼リストの署名者証明書かを示すフラグ。
pCtlContextCTL_CONTEXT*8/4+64+44CTLコンテキストへのポインタ。
dwCtlErrorDWORD4+72+48CTL検証のエラーコードを表す。
fIsCyclicBOOL4+76+52証明書チェーンが循環しているかを示すフラグ。
pChainElementCERT_CHAIN_ELEMENT*8/4+80+56対応する証明書チェーン要素へのポインタ。

各言語での定義

#include <windows.h>

// CRYPT_PROVIDER_CERT  (x64 88 / x86 60 バイト)
typedef struct CRYPT_PROVIDER_CERT {
    DWORD cbStruct;
    CERT_CONTEXT* pCert;
    BOOL fCommercial;
    BOOL fTrustedRoot;
    BOOL fSelfSigned;
    BOOL fTestCert;
    DWORD dwRevokedReason;
    DWORD dwConfidence;
    DWORD dwError;
    CTL_CONTEXT* pTrustListContext;
    BOOL fTrustListSignerCert;
    CTL_CONTEXT* pCtlContext;
    DWORD dwCtlError;
    BOOL fIsCyclic;
    CERT_CHAIN_ELEMENT* pChainElement;
} CRYPT_PROVIDER_CERT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CRYPT_PROVIDER_CERT
{
    public uint cbStruct;
    public IntPtr pCert;
    [MarshalAs(UnmanagedType.Bool)] public bool fCommercial;
    [MarshalAs(UnmanagedType.Bool)] public bool fTrustedRoot;
    [MarshalAs(UnmanagedType.Bool)] public bool fSelfSigned;
    [MarshalAs(UnmanagedType.Bool)] public bool fTestCert;
    public uint dwRevokedReason;
    public uint dwConfidence;
    public uint dwError;
    public IntPtr pTrustListContext;
    [MarshalAs(UnmanagedType.Bool)] public bool fTrustListSignerCert;
    public IntPtr pCtlContext;
    public uint dwCtlError;
    [MarshalAs(UnmanagedType.Bool)] public bool fIsCyclic;
    public IntPtr pChainElement;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CRYPT_PROVIDER_CERT
    Public cbStruct As UInteger
    Public pCert As IntPtr
    <MarshalAs(UnmanagedType.Bool)> Public fCommercial As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fTrustedRoot As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fSelfSigned As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fTestCert As Boolean
    Public dwRevokedReason As UInteger
    Public dwConfidence As UInteger
    Public dwError As UInteger
    Public pTrustListContext As IntPtr
    <MarshalAs(UnmanagedType.Bool)> Public fTrustListSignerCert As Boolean
    Public pCtlContext As IntPtr
    Public dwCtlError As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public fIsCyclic As Boolean
    Public pChainElement As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class CRYPT_PROVIDER_CERT(ctypes.Structure):
    _fields_ = [
        ("cbStruct", wintypes.DWORD),
        ("pCert", ctypes.c_void_p),
        ("fCommercial", wintypes.BOOL),
        ("fTrustedRoot", wintypes.BOOL),
        ("fSelfSigned", wintypes.BOOL),
        ("fTestCert", wintypes.BOOL),
        ("dwRevokedReason", wintypes.DWORD),
        ("dwConfidence", wintypes.DWORD),
        ("dwError", wintypes.DWORD),
        ("pTrustListContext", ctypes.c_void_p),
        ("fTrustListSignerCert", wintypes.BOOL),
        ("pCtlContext", ctypes.c_void_p),
        ("dwCtlError", wintypes.DWORD),
        ("fIsCyclic", wintypes.BOOL),
        ("pChainElement", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct CRYPT_PROVIDER_CERT {
    pub cbStruct: u32,
    pub pCert: *mut core::ffi::c_void,
    pub fCommercial: i32,
    pub fTrustedRoot: i32,
    pub fSelfSigned: i32,
    pub fTestCert: i32,
    pub dwRevokedReason: u32,
    pub dwConfidence: u32,
    pub dwError: u32,
    pub pTrustListContext: *mut core::ffi::c_void,
    pub fTrustListSignerCert: i32,
    pub pCtlContext: *mut core::ffi::c_void,
    pub dwCtlError: u32,
    pub fIsCyclic: i32,
    pub pChainElement: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type CRYPT_PROVIDER_CERT struct {
	cbStruct uint32
	pCert uintptr
	fCommercial int32
	fTrustedRoot int32
	fSelfSigned int32
	fTestCert int32
	dwRevokedReason uint32
	dwConfidence uint32
	dwError uint32
	pTrustListContext uintptr
	fTrustListSignerCert int32
	pCtlContext uintptr
	dwCtlError uint32
	fIsCyclic int32
	pChainElement uintptr
}
type
  CRYPT_PROVIDER_CERT = record
    cbStruct: DWORD;
    pCert: Pointer;
    fCommercial: BOOL;
    fTrustedRoot: BOOL;
    fSelfSigned: BOOL;
    fTestCert: BOOL;
    dwRevokedReason: DWORD;
    dwConfidence: DWORD;
    dwError: DWORD;
    pTrustListContext: Pointer;
    fTrustListSignerCert: BOOL;
    pCtlContext: Pointer;
    dwCtlError: DWORD;
    fIsCyclic: BOOL;
    pChainElement: Pointer;
  end;
const CRYPT_PROVIDER_CERT = extern struct {
    cbStruct: u32,
    pCert: ?*anyopaque,
    fCommercial: i32,
    fTrustedRoot: i32,
    fSelfSigned: i32,
    fTestCert: i32,
    dwRevokedReason: u32,
    dwConfidence: u32,
    dwError: u32,
    pTrustListContext: ?*anyopaque,
    fTrustListSignerCert: i32,
    pCtlContext: ?*anyopaque,
    dwCtlError: u32,
    fIsCyclic: i32,
    pChainElement: ?*anyopaque,
};
type
  CRYPT_PROVIDER_CERT {.bycopy.} = object
    cbStruct: uint32
    pCert: pointer
    fCommercial: int32
    fTrustedRoot: int32
    fSelfSigned: int32
    fTestCert: int32
    dwRevokedReason: uint32
    dwConfidence: uint32
    dwError: uint32
    pTrustListContext: pointer
    fTrustListSignerCert: int32
    pCtlContext: pointer
    dwCtlError: uint32
    fIsCyclic: int32
    pChainElement: pointer
struct CRYPT_PROVIDER_CERT
{
    uint cbStruct;
    void* pCert;
    int fCommercial;
    int fTrustedRoot;
    int fSelfSigned;
    int fTestCert;
    uint dwRevokedReason;
    uint dwConfidence;
    uint dwError;
    void* pTrustListContext;
    int fTrustListSignerCert;
    void* pCtlContext;
    uint dwCtlError;
    int fIsCyclic;
    void* pChainElement;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CRYPT_PROVIDER_CERT サイズ: 60 バイト(x86)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pCert : CERT_CONTEXT* (+4, 4byte)  varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; fCommercial : BOOL (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; fTrustedRoot : BOOL (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; fSelfSigned : BOOL (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; fTestCert : BOOL (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwRevokedReason : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwConfidence : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwError : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; pTrustListContext : CTL_CONTEXT* (+36, 4byte)  varptr(st)+36 を基点に操作(4byte:入れ子/配列)
; fTrustListSignerCert : BOOL (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; pCtlContext : CTL_CONTEXT* (+44, 4byte)  varptr(st)+44 を基点に操作(4byte:入れ子/配列)
; dwCtlError : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; fIsCyclic : BOOL (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; pChainElement : CERT_CHAIN_ELEMENT* (+56, 4byte)  varptr(st)+56 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CRYPT_PROVIDER_CERT サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pCert : CERT_CONTEXT* (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; fCommercial : BOOL (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; fTrustedRoot : BOOL (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; fSelfSigned : BOOL (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; fTestCert : BOOL (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwRevokedReason : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwConfidence : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dwError : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; pTrustListContext : CTL_CONTEXT* (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; fTrustListSignerCert : BOOL (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; pCtlContext : CTL_CONTEXT* (+64, 8byte)  varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; dwCtlError : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; fIsCyclic : BOOL (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; pChainElement : CERT_CHAIN_ELEMENT* (+80, 8byte)  varptr(st)+80 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CRYPT_PROVIDER_CERT
    #field int cbStruct
    #field intptr pCert
    #field bool fCommercial
    #field bool fTrustedRoot
    #field bool fSelfSigned
    #field bool fTestCert
    #field int dwRevokedReason
    #field int dwConfidence
    #field int dwError
    #field intptr pTrustListContext
    #field bool fTrustListSignerCert
    #field intptr pCtlContext
    #field int dwCtlError
    #field bool fIsCyclic
    #field intptr pChainElement
#endstruct

stdim st, CRYPT_PROVIDER_CERT        ; NSTRUCT 変数を確保
st->cbStruct = 100
mes "cbStruct=" + st->cbStruct