ホーム › Security.WinTrust › CRYPT_PROVIDER_SIGSTATE
CRYPT_PROVIDER_SIGSTATE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbStruct | DWORD | 4 | +0 | +0 | 本構造体のバイトサイズ。 |
| rhSecondarySigs | void** | 8/4 | +8 | +4 | 副署名のハンドル配列へのポインタ。 |
| hPrimarySig | void* | 8/4 | +16 | +8 | 主署名のハンドル。 |
| fFirstAttemptMade | BOOL | 4 | +24 | +12 | 最初の検証試行が実施済みかを示すフラグ。 |
| fNoMoreSigs | BOOL | 4 | +28 | +16 | これ以上検証すべき署名がないかを示すフラグ。 |
| cSecondarySigs | DWORD | 4 | +32 | +20 | 検出された副署名の数。 |
| dwCurrentIndex | DWORD | 4 | +36 | +24 | 現在処理中の署名インデックス。 |
| fSupportMultiSig | BOOL | 4 | +40 | +28 | 複数署名をサポートするかを示すフラグ。 |
| dwCryptoPolicySupport | DWORD | 4 | +44 | +32 | 暗号ポリシーのサポート状況を表す。 |
| iAttemptCount | DWORD | 4 | +48 | +36 | 署名検証の試行回数。 |
| fCheckedSealing | BOOL | 4 | +52 | +40 | 署名のシール(封印)を確認済みかを示すフラグ。 |
| pSealingSignature | SEALING_SIGNATURE_ATTRIBUTE* | 8/4 | +56 | +44 | シール署名属性構造体へのポインタ。NULL可。 |
各言語での定義
#include <windows.h>
// CRYPT_PROVIDER_SIGSTATE (x64 64 / x86 48 バイト)
typedef struct CRYPT_PROVIDER_SIGSTATE {
DWORD cbStruct;
void** rhSecondarySigs;
void* hPrimarySig;
BOOL fFirstAttemptMade;
BOOL fNoMoreSigs;
DWORD cSecondarySigs;
DWORD dwCurrentIndex;
BOOL fSupportMultiSig;
DWORD dwCryptoPolicySupport;
DWORD iAttemptCount;
BOOL fCheckedSealing;
SEALING_SIGNATURE_ATTRIBUTE* pSealingSignature;
} CRYPT_PROVIDER_SIGSTATE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CRYPT_PROVIDER_SIGSTATE
{
public uint cbStruct;
public IntPtr rhSecondarySigs;
public IntPtr hPrimarySig;
[MarshalAs(UnmanagedType.Bool)] public bool fFirstAttemptMade;
[MarshalAs(UnmanagedType.Bool)] public bool fNoMoreSigs;
public uint cSecondarySigs;
public uint dwCurrentIndex;
[MarshalAs(UnmanagedType.Bool)] public bool fSupportMultiSig;
public uint dwCryptoPolicySupport;
public uint iAttemptCount;
[MarshalAs(UnmanagedType.Bool)] public bool fCheckedSealing;
public IntPtr pSealingSignature;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CRYPT_PROVIDER_SIGSTATE
Public cbStruct As UInteger
Public rhSecondarySigs As IntPtr
Public hPrimarySig As IntPtr
<MarshalAs(UnmanagedType.Bool)> Public fFirstAttemptMade As Boolean
<MarshalAs(UnmanagedType.Bool)> Public fNoMoreSigs As Boolean
Public cSecondarySigs As UInteger
Public dwCurrentIndex As UInteger
<MarshalAs(UnmanagedType.Bool)> Public fSupportMultiSig As Boolean
Public dwCryptoPolicySupport As UInteger
Public iAttemptCount As UInteger
<MarshalAs(UnmanagedType.Bool)> Public fCheckedSealing As Boolean
Public pSealingSignature As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class CRYPT_PROVIDER_SIGSTATE(ctypes.Structure):
_fields_ = [
("cbStruct", wintypes.DWORD),
("rhSecondarySigs", ctypes.c_void_p),
("hPrimarySig", ctypes.c_void_p),
("fFirstAttemptMade", wintypes.BOOL),
("fNoMoreSigs", wintypes.BOOL),
("cSecondarySigs", wintypes.DWORD),
("dwCurrentIndex", wintypes.DWORD),
("fSupportMultiSig", wintypes.BOOL),
("dwCryptoPolicySupport", wintypes.DWORD),
("iAttemptCount", wintypes.DWORD),
("fCheckedSealing", wintypes.BOOL),
("pSealingSignature", ctypes.c_void_p),
]#[repr(C)]
pub struct CRYPT_PROVIDER_SIGSTATE {
pub cbStruct: u32,
pub rhSecondarySigs: *mut core::ffi::c_void,
pub hPrimarySig: *mut core::ffi::c_void,
pub fFirstAttemptMade: i32,
pub fNoMoreSigs: i32,
pub cSecondarySigs: u32,
pub dwCurrentIndex: u32,
pub fSupportMultiSig: i32,
pub dwCryptoPolicySupport: u32,
pub iAttemptCount: u32,
pub fCheckedSealing: i32,
pub pSealingSignature: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type CRYPT_PROVIDER_SIGSTATE struct {
cbStruct uint32
rhSecondarySigs uintptr
hPrimarySig uintptr
fFirstAttemptMade int32
fNoMoreSigs int32
cSecondarySigs uint32
dwCurrentIndex uint32
fSupportMultiSig int32
dwCryptoPolicySupport uint32
iAttemptCount uint32
fCheckedSealing int32
pSealingSignature uintptr
}type
CRYPT_PROVIDER_SIGSTATE = record
cbStruct: DWORD;
rhSecondarySigs: Pointer;
hPrimarySig: Pointer;
fFirstAttemptMade: BOOL;
fNoMoreSigs: BOOL;
cSecondarySigs: DWORD;
dwCurrentIndex: DWORD;
fSupportMultiSig: BOOL;
dwCryptoPolicySupport: DWORD;
iAttemptCount: DWORD;
fCheckedSealing: BOOL;
pSealingSignature: Pointer;
end;const CRYPT_PROVIDER_SIGSTATE = extern struct {
cbStruct: u32,
rhSecondarySigs: ?*anyopaque,
hPrimarySig: ?*anyopaque,
fFirstAttemptMade: i32,
fNoMoreSigs: i32,
cSecondarySigs: u32,
dwCurrentIndex: u32,
fSupportMultiSig: i32,
dwCryptoPolicySupport: u32,
iAttemptCount: u32,
fCheckedSealing: i32,
pSealingSignature: ?*anyopaque,
};type
CRYPT_PROVIDER_SIGSTATE {.bycopy.} = object
cbStruct: uint32
rhSecondarySigs: pointer
hPrimarySig: pointer
fFirstAttemptMade: int32
fNoMoreSigs: int32
cSecondarySigs: uint32
dwCurrentIndex: uint32
fSupportMultiSig: int32
dwCryptoPolicySupport: uint32
iAttemptCount: uint32
fCheckedSealing: int32
pSealingSignature: pointerstruct CRYPT_PROVIDER_SIGSTATE
{
uint cbStruct;
void* rhSecondarySigs;
void* hPrimarySig;
int fFirstAttemptMade;
int fNoMoreSigs;
uint cSecondarySigs;
uint dwCurrentIndex;
int fSupportMultiSig;
uint dwCryptoPolicySupport;
uint iAttemptCount;
int fCheckedSealing;
void* pSealingSignature;
}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_SIGSTATE サイズ: 48 バイト(x86)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; rhSecondarySigs : void** (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hPrimarySig : void* (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; fFirstAttemptMade : BOOL (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; fNoMoreSigs : BOOL (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; cSecondarySigs : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwCurrentIndex : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; fSupportMultiSig : BOOL (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwCryptoPolicySupport : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; iAttemptCount : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; fCheckedSealing : BOOL (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; pSealingSignature : SEALING_SIGNATURE_ATTRIBUTE* (+44, 4byte) varptr(st)+44 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CRYPT_PROVIDER_SIGSTATE サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; rhSecondarySigs : void** (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; hPrimarySig : void* (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; fFirstAttemptMade : BOOL (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; fNoMoreSigs : BOOL (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; cSecondarySigs : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; dwCurrentIndex : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; fSupportMultiSig : BOOL (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwCryptoPolicySupport : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; iAttemptCount : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; fCheckedSealing : BOOL (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; pSealingSignature : SEALING_SIGNATURE_ATTRIBUTE* (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CRYPT_PROVIDER_SIGSTATE
#field int cbStruct
#field intptr rhSecondarySigs
#field intptr hPrimarySig
#field bool fFirstAttemptMade
#field bool fNoMoreSigs
#field int cSecondarySigs
#field int dwCurrentIndex
#field bool fSupportMultiSig
#field int dwCryptoPolicySupport
#field int iAttemptCount
#field bool fCheckedSealing
#field intptr pSealingSignature
#endstruct
stdim st, CRYPT_PROVIDER_SIGSTATE ; NSTRUCT 変数を確保
st->cbStruct = 100
mes "cbStruct=" + st->cbStruct