ホーム › Security.Cryptography › OCSP_BASIC_RESPONSE_INFO
OCSP_BASIC_RESPONSE_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwVersion | DWORD | 4 | +0 | +0 | 基本OCSP応答のバージョン番号(通常はv1)。 |
| dwResponderIdChoice | DWORD | 4 | +4 | +4 | 応答者IDの指定方法(名前または鍵ハッシュ)を示す選択子。 |
| Anonymous | _Anonymous_e__Union | 16/8 | +8 | +8 | 応答者の識別名または鍵ハッシュを保持する共用体。 |
| ProducedAt | FILETIME | 8 | +24 | +16 | 応答が生成された日時を示すFILETIME。 |
| cResponseEntry | DWORD | 4 | +32 | +24 | rgResponseEntry配列の要素数。 |
| rgResponseEntry | OCSP_BASIC_RESPONSE_ENTRY* | 8/4 | +40 | +28 | 証明書ごとの状態応答エントリ配列へのポインタ。 |
| cExtension | DWORD | 4 | +48 | +32 | rgExtension配列の要素数。 |
| rgExtension | CERT_EXTENSION* | 8/4 | +56 | +36 | 応答全体に付随する拡張の配列へのポインタ。NULL可。 |
共用体: _Anonymous_e__Union x64 16B / x86 8B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| ByNameResponderId | CRYPT_INTEGER_BLOB | 16/8 | +0 | +0 |
| ByKeyResponderId | CRYPT_INTEGER_BLOB | 16/8 | +0 | +0 |
各言語での定義
#include <windows.h>
// FILETIME (x64 8 / x86 8 バイト)
typedef struct FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
// OCSP_BASIC_RESPONSE_INFO (x64 64 / x86 40 バイト)
typedef struct OCSP_BASIC_RESPONSE_INFO {
DWORD dwVersion;
DWORD dwResponderIdChoice;
_Anonymous_e__Union Anonymous;
FILETIME ProducedAt;
DWORD cResponseEntry;
OCSP_BASIC_RESPONSE_ENTRY* rgResponseEntry;
DWORD cExtension;
CERT_EXTENSION* rgExtension;
} OCSP_BASIC_RESPONSE_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILETIME
{
public uint dwLowDateTime;
public uint dwHighDateTime;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct OCSP_BASIC_RESPONSE_INFO
{
public uint dwVersion;
public uint dwResponderIdChoice;
public _Anonymous_e__Union Anonymous;
public FILETIME ProducedAt;
public uint cResponseEntry;
public IntPtr rgResponseEntry;
public uint cExtension;
public IntPtr rgExtension;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILETIME
Public dwLowDateTime As UInteger
Public dwHighDateTime As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure OCSP_BASIC_RESPONSE_INFO
Public dwVersion As UInteger
Public dwResponderIdChoice As UInteger
Public Anonymous As _Anonymous_e__Union
Public ProducedAt As FILETIME
Public cResponseEntry As UInteger
Public rgResponseEntry As IntPtr
Public cExtension As UInteger
Public rgExtension As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class FILETIME(ctypes.Structure):
_fields_ = [
("dwLowDateTime", wintypes.DWORD),
("dwHighDateTime", wintypes.DWORD),
]
class OCSP_BASIC_RESPONSE_INFO(ctypes.Structure):
_fields_ = [
("dwVersion", wintypes.DWORD),
("dwResponderIdChoice", wintypes.DWORD),
("Anonymous", _Anonymous_e__Union),
("ProducedAt", FILETIME),
("cResponseEntry", wintypes.DWORD),
("rgResponseEntry", ctypes.c_void_p),
("cExtension", wintypes.DWORD),
("rgExtension", ctypes.c_void_p),
]#[repr(C)]
pub struct FILETIME {
pub dwLowDateTime: u32,
pub dwHighDateTime: u32,
}
#[repr(C)]
pub struct OCSP_BASIC_RESPONSE_INFO {
pub dwVersion: u32,
pub dwResponderIdChoice: u32,
pub Anonymous: _Anonymous_e__Union,
pub ProducedAt: FILETIME,
pub cResponseEntry: u32,
pub rgResponseEntry: *mut core::ffi::c_void,
pub cExtension: u32,
pub rgExtension: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type FILETIME struct {
dwLowDateTime uint32
dwHighDateTime uint32
}
type OCSP_BASIC_RESPONSE_INFO struct {
dwVersion uint32
dwResponderIdChoice uint32
Anonymous _Anonymous_e__Union
ProducedAt FILETIME
cResponseEntry uint32
rgResponseEntry uintptr
cExtension uint32
rgExtension uintptr
}type
FILETIME = record
dwLowDateTime: DWORD;
dwHighDateTime: DWORD;
end;
OCSP_BASIC_RESPONSE_INFO = record
dwVersion: DWORD;
dwResponderIdChoice: DWORD;
Anonymous: _Anonymous_e__Union;
ProducedAt: FILETIME;
cResponseEntry: DWORD;
rgResponseEntry: Pointer;
cExtension: DWORD;
rgExtension: Pointer;
end;const FILETIME = extern struct {
dwLowDateTime: u32,
dwHighDateTime: u32,
};
const OCSP_BASIC_RESPONSE_INFO = extern struct {
dwVersion: u32,
dwResponderIdChoice: u32,
Anonymous: _Anonymous_e__Union,
ProducedAt: FILETIME,
cResponseEntry: u32,
rgResponseEntry: ?*anyopaque,
cExtension: u32,
rgExtension: ?*anyopaque,
};type
FILETIME {.bycopy.} = object
dwLowDateTime: uint32
dwHighDateTime: uint32
OCSP_BASIC_RESPONSE_INFO {.bycopy.} = object
dwVersion: uint32
dwResponderIdChoice: uint32
Anonymous: _Anonymous_e__Union
ProducedAt: FILETIME
cResponseEntry: uint32
rgResponseEntry: pointer
cExtension: uint32
rgExtension: pointerstruct FILETIME
{
uint dwLowDateTime;
uint dwHighDateTime;
}
struct OCSP_BASIC_RESPONSE_INFO
{
uint dwVersion;
uint dwResponderIdChoice;
_Anonymous_e__Union Anonymous;
FILETIME ProducedAt;
uint cResponseEntry;
void* rgResponseEntry;
uint cExtension;
void* rgExtension;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; OCSP_BASIC_RESPONSE_INFO サイズ: 40 バイト(x86)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwResponderIdChoice : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; ProducedAt : FILETIME (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; cResponseEntry : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; rgResponseEntry : OCSP_BASIC_RESPONSE_ENTRY* (+28, 4byte) varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; cExtension : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; rgExtension : CERT_EXTENSION* (+36, 4byte) varptr(st)+36 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; OCSP_BASIC_RESPONSE_INFO サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwResponderIdChoice : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+8, 16byte) varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; ProducedAt : FILETIME (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; cResponseEntry : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; rgResponseEntry : OCSP_BASIC_RESPONSE_ENTRY* (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; cExtension : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; rgExtension : CERT_EXTENSION* (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global FILETIME
#field int dwLowDateTime
#field int dwHighDateTime
#endstruct
#defstruct global OCSP_BASIC_RESPONSE_INFO
#field int dwVersion
#field int dwResponderIdChoice
#field byte Anonymous 16
#field FILETIME ProducedAt
#field int cResponseEntry
#field intptr rgResponseEntry
#field int cExtension
#field intptr rgExtension
#endstruct
stdim st, OCSP_BASIC_RESPONSE_INFO ; NSTRUCT 変数を確保
st->dwVersion = 100
mes "dwVersion=" + st->dwVersion
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。