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

CRL_CONTEXT

構造体
サイズx64: 40 バイト / x86: 20 バイト

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

フィールド

フィールドサイズx64x86説明
dwCertEncodingTypeCERT_QUERY_ENCODING_TYPE4+0+0

使用されるエンコードの種類です。次の例のように、証明書のエンコードの種類とメッセージのエンコードの種類をビット単位の OR 演算で組み合わせて両方を指定することは、常に許容されます。

X509_ASN_ENCODING | PKCS_7_ASN_ENCODING

現在定義されているエンコードの種類は次のとおりです。

pbCrlEncodedBYTE*8/4+8+4エンコードされた CRL 情報へのポインターです。
cbCrlEncodedDWORD4+16+8エンコードされた CRL 情報のサイズ (バイト単位) です。
pCrlInfoCRL_INFO*8/4+24+12CRL 情報を格納している CRL_INFO 構造体へのポインターです。
hCertStoreHCERTSTORE8/4+32+16証明書ストアへのハンドルです。

公式ドキュメント

CRL_CONTEXT 構造体は、証明書失効リスト (CRL) のエンコードされた表現とデコードされた表現の両方を格納します。CryptoAPI の関数から返された CRL コンテキストは、 CertFreeCRLContext 関数を呼び出して解放しなければなりません。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// CRL_CONTEXT  (x64 40 / x86 20 バイト)
typedef struct CRL_CONTEXT {
    CERT_QUERY_ENCODING_TYPE dwCertEncodingType;
    BYTE* pbCrlEncoded;
    DWORD cbCrlEncoded;
    CRL_INFO* pCrlInfo;
    HCERTSTORE hCertStore;
} CRL_CONTEXT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CRL_CONTEXT
{
    public uint dwCertEncodingType;
    public IntPtr pbCrlEncoded;
    public uint cbCrlEncoded;
    public IntPtr pCrlInfo;
    public IntPtr hCertStore;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CRL_CONTEXT
    Public dwCertEncodingType As UInteger
    Public pbCrlEncoded As IntPtr
    Public cbCrlEncoded As UInteger
    Public pCrlInfo As IntPtr
    Public hCertStore As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class CRL_CONTEXT(ctypes.Structure):
    _fields_ = [
        ("dwCertEncodingType", wintypes.DWORD),
        ("pbCrlEncoded", ctypes.c_void_p),
        ("cbCrlEncoded", wintypes.DWORD),
        ("pCrlInfo", ctypes.c_void_p),
        ("hCertStore", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct CRL_CONTEXT {
    pub dwCertEncodingType: u32,
    pub pbCrlEncoded: *mut core::ffi::c_void,
    pub cbCrlEncoded: u32,
    pub pCrlInfo: *mut core::ffi::c_void,
    pub hCertStore: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type CRL_CONTEXT struct {
	dwCertEncodingType uint32
	pbCrlEncoded uintptr
	cbCrlEncoded uint32
	pCrlInfo uintptr
	hCertStore uintptr
}
type
  CRL_CONTEXT = record
    dwCertEncodingType: DWORD;
    pbCrlEncoded: Pointer;
    cbCrlEncoded: DWORD;
    pCrlInfo: Pointer;
    hCertStore: Pointer;
  end;
const CRL_CONTEXT = extern struct {
    dwCertEncodingType: u32,
    pbCrlEncoded: ?*anyopaque,
    cbCrlEncoded: u32,
    pCrlInfo: ?*anyopaque,
    hCertStore: ?*anyopaque,
};
type
  CRL_CONTEXT {.bycopy.} = object
    dwCertEncodingType: uint32
    pbCrlEncoded: pointer
    cbCrlEncoded: uint32
    pCrlInfo: pointer
    hCertStore: pointer
struct CRL_CONTEXT
{
    uint dwCertEncodingType;
    void* pbCrlEncoded;
    uint cbCrlEncoded;
    void* pCrlInfo;
    void* hCertStore;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CRL_CONTEXT サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; dwCertEncodingType : CERT_QUERY_ENCODING_TYPE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pbCrlEncoded : BYTE* (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cbCrlEncoded : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pCrlInfo : CRL_INFO* (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; hCertStore : HCERTSTORE (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CRL_CONTEXT サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; dwCertEncodingType : CERT_QUERY_ENCODING_TYPE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pbCrlEncoded : BYTE* (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; cbCrlEncoded : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; pCrlInfo : CRL_INFO* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; hCertStore : HCERTSTORE (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CRL_CONTEXT
    #field int dwCertEncodingType
    #field intptr pbCrlEncoded
    #field int cbCrlEncoded
    #field intptr pCrlInfo
    #field intptr hCertStore
#endstruct

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