ホーム › Security.Cryptography › CERT_SIMPLE_CHAIN
CERT_SIMPLE_CHAIN
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のサイズ(バイト単位)。 |
| TrustStatus | CERT_TRUST_STATUS | 8 | +4 | +4 | この単純チェーン全体の信頼状態。 |
| cElement | DWORD | 4 | +12 | +12 | rgpElement配列の要素数。 |
| rgpElement | CERT_CHAIN_ELEMENT** | 8/4 | +16 | +16 | 末端からルートへ並ぶチェーン要素ポインタの配列へのポインタ。 |
| pTrustListInfo | CERT_TRUST_LIST_INFO* | 8/4 | +24 | +20 | このチェーンに適用されるCTL情報へのポインタ。NULL可。 |
| fHasRevocationFreshnessTime | BOOL | 4 | +32 | +24 | dwRevocationFreshnessTimeが有効かを示すブール値。 |
| dwRevocationFreshnessTime | DWORD | 4 | +36 | +28 | 失効情報の鮮度(秒単位)。フラグがTRUEで有効。 |
各言語での定義
#include <windows.h>
// CERT_TRUST_STATUS (x64 8 / x86 8 バイト)
typedef struct CERT_TRUST_STATUS {
DWORD dwErrorStatus;
DWORD dwInfoStatus;
} CERT_TRUST_STATUS;
// CERT_SIMPLE_CHAIN (x64 40 / x86 32 バイト)
typedef struct CERT_SIMPLE_CHAIN {
DWORD cbSize;
CERT_TRUST_STATUS TrustStatus;
DWORD cElement;
CERT_CHAIN_ELEMENT** rgpElement;
CERT_TRUST_LIST_INFO* pTrustListInfo;
BOOL fHasRevocationFreshnessTime;
DWORD dwRevocationFreshnessTime;
} CERT_SIMPLE_CHAIN;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CERT_TRUST_STATUS
{
public uint dwErrorStatus;
public uint dwInfoStatus;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CERT_SIMPLE_CHAIN
{
public uint cbSize;
public CERT_TRUST_STATUS TrustStatus;
public uint cElement;
public IntPtr rgpElement;
public IntPtr pTrustListInfo;
[MarshalAs(UnmanagedType.Bool)] public bool fHasRevocationFreshnessTime;
public uint dwRevocationFreshnessTime;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CERT_TRUST_STATUS
Public dwErrorStatus As UInteger
Public dwInfoStatus As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CERT_SIMPLE_CHAIN
Public cbSize As UInteger
Public TrustStatus As CERT_TRUST_STATUS
Public cElement As UInteger
Public rgpElement As IntPtr
Public pTrustListInfo As IntPtr
<MarshalAs(UnmanagedType.Bool)> Public fHasRevocationFreshnessTime As Boolean
Public dwRevocationFreshnessTime As UInteger
End Structureimport ctypes
from ctypes import wintypes
class CERT_TRUST_STATUS(ctypes.Structure):
_fields_ = [
("dwErrorStatus", wintypes.DWORD),
("dwInfoStatus", wintypes.DWORD),
]
class CERT_SIMPLE_CHAIN(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("TrustStatus", CERT_TRUST_STATUS),
("cElement", wintypes.DWORD),
("rgpElement", ctypes.c_void_p),
("pTrustListInfo", ctypes.c_void_p),
("fHasRevocationFreshnessTime", wintypes.BOOL),
("dwRevocationFreshnessTime", wintypes.DWORD),
]#[repr(C)]
pub struct CERT_TRUST_STATUS {
pub dwErrorStatus: u32,
pub dwInfoStatus: u32,
}
#[repr(C)]
pub struct CERT_SIMPLE_CHAIN {
pub cbSize: u32,
pub TrustStatus: CERT_TRUST_STATUS,
pub cElement: u32,
pub rgpElement: *mut core::ffi::c_void,
pub pTrustListInfo: *mut core::ffi::c_void,
pub fHasRevocationFreshnessTime: i32,
pub dwRevocationFreshnessTime: u32,
}import "golang.org/x/sys/windows"
type CERT_TRUST_STATUS struct {
dwErrorStatus uint32
dwInfoStatus uint32
}
type CERT_SIMPLE_CHAIN struct {
cbSize uint32
TrustStatus CERT_TRUST_STATUS
cElement uint32
rgpElement uintptr
pTrustListInfo uintptr
fHasRevocationFreshnessTime int32
dwRevocationFreshnessTime uint32
}type
CERT_TRUST_STATUS = record
dwErrorStatus: DWORD;
dwInfoStatus: DWORD;
end;
CERT_SIMPLE_CHAIN = record
cbSize: DWORD;
TrustStatus: CERT_TRUST_STATUS;
cElement: DWORD;
rgpElement: Pointer;
pTrustListInfo: Pointer;
fHasRevocationFreshnessTime: BOOL;
dwRevocationFreshnessTime: DWORD;
end;const CERT_TRUST_STATUS = extern struct {
dwErrorStatus: u32,
dwInfoStatus: u32,
};
const CERT_SIMPLE_CHAIN = extern struct {
cbSize: u32,
TrustStatus: CERT_TRUST_STATUS,
cElement: u32,
rgpElement: ?*anyopaque,
pTrustListInfo: ?*anyopaque,
fHasRevocationFreshnessTime: i32,
dwRevocationFreshnessTime: u32,
};type
CERT_TRUST_STATUS {.bycopy.} = object
dwErrorStatus: uint32
dwInfoStatus: uint32
CERT_SIMPLE_CHAIN {.bycopy.} = object
cbSize: uint32
TrustStatus: CERT_TRUST_STATUS
cElement: uint32
rgpElement: pointer
pTrustListInfo: pointer
fHasRevocationFreshnessTime: int32
dwRevocationFreshnessTime: uint32struct CERT_TRUST_STATUS
{
uint dwErrorStatus;
uint dwInfoStatus;
}
struct CERT_SIMPLE_CHAIN
{
uint cbSize;
CERT_TRUST_STATUS TrustStatus;
uint cElement;
void* rgpElement;
void* pTrustListInfo;
int fHasRevocationFreshnessTime;
uint dwRevocationFreshnessTime;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CERT_SIMPLE_CHAIN サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; TrustStatus : CERT_TRUST_STATUS (+4, 8byte) varptr(st)+4 を基点に操作(8byte:入れ子/配列)
; cElement : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; rgpElement : CERT_CHAIN_ELEMENT** (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; pTrustListInfo : CERT_TRUST_LIST_INFO* (+20, 4byte) varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; fHasRevocationFreshnessTime : BOOL (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwRevocationFreshnessTime : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CERT_SIMPLE_CHAIN サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; TrustStatus : CERT_TRUST_STATUS (+4, 8byte) varptr(st)+4 を基点に操作(8byte:入れ子/配列)
; cElement : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; rgpElement : CERT_CHAIN_ELEMENT** (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; pTrustListInfo : CERT_TRUST_LIST_INFO* (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; fHasRevocationFreshnessTime : BOOL (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; dwRevocationFreshnessTime : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global CERT_TRUST_STATUS
#field int dwErrorStatus
#field int dwInfoStatus
#endstruct
#defstruct global CERT_SIMPLE_CHAIN
#field int cbSize
#field CERT_TRUST_STATUS TrustStatus
#field int cElement
#field intptr rgpElement
#field intptr pTrustListInfo
#field bool fHasRevocationFreshnessTime
#field int dwRevocationFreshnessTime
#endstruct
stdim st, CERT_SIMPLE_CHAIN ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize