ホーム › Security.Cryptography.Sip › SIP_SUBJECTINFO
SIP_SUBJECTINFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のサイズ (バイト単位)。 | ||||||||||||
| pgSubjectType | GUID* | 8/4 | +8 | +4 | サブジェクトの種類を識別する GUID 構造体へのポインター。 | ||||||||||||
| hFile | HANDLE | 8/4 | +16 | +8 | サブジェクトを表すファイル ハンドル。サブジェクトの格納形式がファイルの場合は、hFile に INVALID_HANDLE_VALUE を設定し、pwsFileName パラメーターにファイル名を設定します。 | ||||||||||||
| pwsFileName | LPWSTR | 8/4 | +24 | +12 | サブジェクトのファイル名を格納する、null で終わる Unicode 文字列へのポインター。 | ||||||||||||
| pwsDisplayName | LPWSTR | 8/4 | +32 | +16 | サブジェクトの表示名を格納する、null で終わる Unicode 文字列へのポインター。 | ||||||||||||
| dwReserved1 | DWORD | 4 | +40 | +20 | このメンバーは将来の使用のために予約済みです。 | ||||||||||||
| dwIntVersion | DWORD | 4 | +44 | +24 | このメンバーは予約済みです。このメンバーを変更しないでください。SIP が取得関数と検証関数の間で内部バージョン番号を 受け渡すために使用します。 | ||||||||||||
| hProv | UINT_PTR | 8/4 | +48 | +28 | 暗号化プロバイダーへの HCRYPTPROV ハンドル。 | ||||||||||||
| DigestAlgorithm | CRYPT_ALGORITHM_IDENTIFIER | 24/12 | +56 | +32 | ファイルのハッシュ計算に使用されるハッシュ アルゴリズムの識別子を格納する CRYPT_ALGORITHM_IDENTIFIER 構造体。 | ||||||||||||
| dwFlags | DWORD | 4 | +80 | +44 | この構造体を使用する関数の動作を変更する値。このメンバーに指定可能な値の詳細については、SignerSignEx の dwFlags パラメーターを参照してください。 | ||||||||||||
| dwEncodingType | DWORD | 4 | +84 | +48 | ファイルに使用されるエンコード種別を指定する値。現在は X509_ASN_ENCODING と PKCS_7_ASN_ENCODING のみが使用されていますが、将来的にエンコード種別が追加される可能性があります。現在のいずれのエンコード種別でも、X509_ASN_ENCODING | PKCS_7_ASN_ENCODING を使用してください。 | ||||||||||||
| dwReserved2 | DWORD | 4 | +88 | +52 | このメンバーは将来の使用のために予約済みです。 | ||||||||||||
| fdwCAPISettings | DWORD | 4 | +92 | +56 | このメンバーは使用されません。 | ||||||||||||
| fdwSecuritySettings | DWORD | 4 | +96 | +60 | このメンバーは使用されません。 | ||||||||||||
| dwIndex | DWORD | 4 | +100 | +64 | 直前に呼び出した CryptSIPGetSignedDataMsg の操作のメッセージ インデックス。 | ||||||||||||
| dwUnionChoice | DWORD | 4 | +104 | +68 | 提供される追加情報の種類を指定します。
| ||||||||||||
| Anonymous | _Anonymous_e__Union | 8/4 | +112 | +72 | 選択に応じた追加データを保持する無名共用体。 | ||||||||||||
| pClientData | void* | 8/4 | +120 | +76 | SIP 固有のデータへのポインター。 |
共用体: _Anonymous_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| psFlat | MS_ADDINFO_FLAT* | 8/4 | +0 | +0 | フラット ファイルのサブジェクト種別に対する追加情報を格納する MS_ADDINFO_FLAT 構造体。 |
| psCatMember | MS_ADDINFO_CATALOGMEMBER* | 8/4 | +0 | +0 | カタログ メンバーのサブジェクト種別に対する追加情報を格納する MS_ADDINFO_CATALOGMEMBER 構造体。 |
| psBlob | MS_ADDINFO_BLOB* | 8/4 | +0 | +0 | BLOB のサブジェクト種別に対する追加情報を格納する MS_ADDINFO_BLOB 構造体。 |
| psDetachedSig | MS_ADDINFO_DETACHEDSIG* | 8/4 | +0 | +0 |
公式ドキュメント
SIP_SUBJECTINFO 構造体は、サブジェクト インターフェイス パッケージ (SIP) API に対してサブジェクト情報データを指定します。
解説(Remarks)
SIP_SUBJECTINFO 構造体を最初に使用する際は、構造体全体をバイナリ 0 で初期化してください。SIP 関数の呼び出しと呼び出しの間で構造体を初期化しないでください。
サブジェクトには、ポータブル実行可能イメージ (.exe)、キャビネット (.cab) イメージ、フラット ファイル、カタログ ファイルなどが含まれます (これらに限定されません)。各サブジェクト種別は、ハッシュ計算にデータの異なる部分集合を使用し、格納と取得に異なる手順を必要とします。そのため、サブジェクト種別ごとに固有のサブジェクト インターフェイス パッケージ仕様があります。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// CRYPT_INTEGER_BLOB (x64 16 / x86 8 バイト)
typedef struct CRYPT_INTEGER_BLOB {
DWORD cbData;
BYTE* pbData;
} CRYPT_INTEGER_BLOB;
// CRYPT_ALGORITHM_IDENTIFIER (x64 24 / x86 12 バイト)
typedef struct CRYPT_ALGORITHM_IDENTIFIER {
LPSTR pszObjId;
CRYPT_INTEGER_BLOB Parameters;
} CRYPT_ALGORITHM_IDENTIFIER;
// SIP_SUBJECTINFO (x64 128 / x86 80 バイト)
typedef struct SIP_SUBJECTINFO {
DWORD cbSize;
GUID* pgSubjectType;
HANDLE hFile;
LPWSTR pwsFileName;
LPWSTR pwsDisplayName;
DWORD dwReserved1;
DWORD dwIntVersion;
UINT_PTR hProv;
CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm;
DWORD dwFlags;
DWORD dwEncodingType;
DWORD dwReserved2;
DWORD fdwCAPISettings;
DWORD fdwSecuritySettings;
DWORD dwIndex;
DWORD dwUnionChoice;
_Anonymous_e__Union Anonymous;
void* pClientData;
} SIP_SUBJECTINFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CRYPT_INTEGER_BLOB
{
public uint cbData;
public IntPtr pbData;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CRYPT_ALGORITHM_IDENTIFIER
{
public IntPtr pszObjId;
public CRYPT_INTEGER_BLOB Parameters;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SIP_SUBJECTINFO
{
public uint cbSize;
public IntPtr pgSubjectType;
public IntPtr hFile;
public IntPtr pwsFileName;
public IntPtr pwsDisplayName;
public uint dwReserved1;
public uint dwIntVersion;
public UIntPtr hProv;
public CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm;
public uint dwFlags;
public uint dwEncodingType;
public uint dwReserved2;
public uint fdwCAPISettings;
public uint fdwSecuritySettings;
public uint dwIndex;
public uint dwUnionChoice;
public _Anonymous_e__Union Anonymous;
public IntPtr pClientData;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CRYPT_INTEGER_BLOB
Public cbData As UInteger
Public pbData As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CRYPT_ALGORITHM_IDENTIFIER
Public pszObjId As IntPtr
Public Parameters As CRYPT_INTEGER_BLOB
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SIP_SUBJECTINFO
Public cbSize As UInteger
Public pgSubjectType As IntPtr
Public hFile As IntPtr
Public pwsFileName As IntPtr
Public pwsDisplayName As IntPtr
Public dwReserved1 As UInteger
Public dwIntVersion As UInteger
Public hProv As UIntPtr
Public DigestAlgorithm As CRYPT_ALGORITHM_IDENTIFIER
Public dwFlags As UInteger
Public dwEncodingType As UInteger
Public dwReserved2 As UInteger
Public fdwCAPISettings As UInteger
Public fdwSecuritySettings As UInteger
Public dwIndex As UInteger
Public dwUnionChoice As UInteger
Public Anonymous As _Anonymous_e__Union
Public pClientData As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class CRYPT_INTEGER_BLOB(ctypes.Structure):
_fields_ = [
("cbData", wintypes.DWORD),
("pbData", ctypes.c_void_p),
]
class CRYPT_ALGORITHM_IDENTIFIER(ctypes.Structure):
_fields_ = [
("pszObjId", ctypes.c_void_p),
("Parameters", CRYPT_INTEGER_BLOB),
]
class SIP_SUBJECTINFO(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("pgSubjectType", ctypes.c_void_p),
("hFile", ctypes.c_void_p),
("pwsFileName", ctypes.c_void_p),
("pwsDisplayName", ctypes.c_void_p),
("dwReserved1", wintypes.DWORD),
("dwIntVersion", wintypes.DWORD),
("hProv", ctypes.c_size_t),
("DigestAlgorithm", CRYPT_ALGORITHM_IDENTIFIER),
("dwFlags", wintypes.DWORD),
("dwEncodingType", wintypes.DWORD),
("dwReserved2", wintypes.DWORD),
("fdwCAPISettings", wintypes.DWORD),
("fdwSecuritySettings", wintypes.DWORD),
("dwIndex", wintypes.DWORD),
("dwUnionChoice", wintypes.DWORD),
("Anonymous", _Anonymous_e__Union),
("pClientData", ctypes.c_void_p),
]#[repr(C)]
pub struct CRYPT_INTEGER_BLOB {
pub cbData: u32,
pub pbData: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct CRYPT_ALGORITHM_IDENTIFIER {
pub pszObjId: *mut core::ffi::c_void,
pub Parameters: CRYPT_INTEGER_BLOB,
}
#[repr(C)]
pub struct SIP_SUBJECTINFO {
pub cbSize: u32,
pub pgSubjectType: *mut core::ffi::c_void,
pub hFile: *mut core::ffi::c_void,
pub pwsFileName: *mut core::ffi::c_void,
pub pwsDisplayName: *mut core::ffi::c_void,
pub dwReserved1: u32,
pub dwIntVersion: u32,
pub hProv: usize,
pub DigestAlgorithm: CRYPT_ALGORITHM_IDENTIFIER,
pub dwFlags: u32,
pub dwEncodingType: u32,
pub dwReserved2: u32,
pub fdwCAPISettings: u32,
pub fdwSecuritySettings: u32,
pub dwIndex: u32,
pub dwUnionChoice: u32,
pub Anonymous: _Anonymous_e__Union,
pub pClientData: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type CRYPT_INTEGER_BLOB struct {
cbData uint32
pbData uintptr
}
type CRYPT_ALGORITHM_IDENTIFIER struct {
pszObjId uintptr
Parameters CRYPT_INTEGER_BLOB
}
type SIP_SUBJECTINFO struct {
cbSize uint32
pgSubjectType uintptr
hFile uintptr
pwsFileName uintptr
pwsDisplayName uintptr
dwReserved1 uint32
dwIntVersion uint32
hProv uintptr
DigestAlgorithm CRYPT_ALGORITHM_IDENTIFIER
dwFlags uint32
dwEncodingType uint32
dwReserved2 uint32
fdwCAPISettings uint32
fdwSecuritySettings uint32
dwIndex uint32
dwUnionChoice uint32
Anonymous _Anonymous_e__Union
pClientData uintptr
}type
CRYPT_INTEGER_BLOB = record
cbData: DWORD;
pbData: Pointer;
end;
CRYPT_ALGORITHM_IDENTIFIER = record
pszObjId: Pointer;
Parameters: CRYPT_INTEGER_BLOB;
end;
SIP_SUBJECTINFO = record
cbSize: DWORD;
pgSubjectType: Pointer;
hFile: Pointer;
pwsFileName: Pointer;
pwsDisplayName: Pointer;
dwReserved1: DWORD;
dwIntVersion: DWORD;
hProv: NativeUInt;
DigestAlgorithm: CRYPT_ALGORITHM_IDENTIFIER;
dwFlags: DWORD;
dwEncodingType: DWORD;
dwReserved2: DWORD;
fdwCAPISettings: DWORD;
fdwSecuritySettings: DWORD;
dwIndex: DWORD;
dwUnionChoice: DWORD;
Anonymous: _Anonymous_e__Union;
pClientData: Pointer;
end;const CRYPT_INTEGER_BLOB = extern struct {
cbData: u32,
pbData: ?*anyopaque,
};
const CRYPT_ALGORITHM_IDENTIFIER = extern struct {
pszObjId: ?*anyopaque,
Parameters: CRYPT_INTEGER_BLOB,
};
const SIP_SUBJECTINFO = extern struct {
cbSize: u32,
pgSubjectType: ?*anyopaque,
hFile: ?*anyopaque,
pwsFileName: ?*anyopaque,
pwsDisplayName: ?*anyopaque,
dwReserved1: u32,
dwIntVersion: u32,
hProv: usize,
DigestAlgorithm: CRYPT_ALGORITHM_IDENTIFIER,
dwFlags: u32,
dwEncodingType: u32,
dwReserved2: u32,
fdwCAPISettings: u32,
fdwSecuritySettings: u32,
dwIndex: u32,
dwUnionChoice: u32,
Anonymous: _Anonymous_e__Union,
pClientData: ?*anyopaque,
};type
CRYPT_INTEGER_BLOB {.bycopy.} = object
cbData: uint32
pbData: pointer
CRYPT_ALGORITHM_IDENTIFIER {.bycopy.} = object
pszObjId: pointer
Parameters: CRYPT_INTEGER_BLOB
SIP_SUBJECTINFO {.bycopy.} = object
cbSize: uint32
pgSubjectType: pointer
hFile: pointer
pwsFileName: pointer
pwsDisplayName: pointer
dwReserved1: uint32
dwIntVersion: uint32
hProv: uint
DigestAlgorithm: CRYPT_ALGORITHM_IDENTIFIER
dwFlags: uint32
dwEncodingType: uint32
dwReserved2: uint32
fdwCAPISettings: uint32
fdwSecuritySettings: uint32
dwIndex: uint32
dwUnionChoice: uint32
Anonymous: _Anonymous_e__Union
pClientData: pointerstruct CRYPT_INTEGER_BLOB
{
uint cbData;
void* pbData;
}
struct CRYPT_ALGORITHM_IDENTIFIER
{
void* pszObjId;
CRYPT_INTEGER_BLOB Parameters;
}
struct SIP_SUBJECTINFO
{
uint cbSize;
void* pgSubjectType;
void* hFile;
void* pwsFileName;
void* pwsDisplayName;
uint dwReserved1;
uint dwIntVersion;
size_t hProv;
CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm;
uint dwFlags;
uint dwEncodingType;
uint dwReserved2;
uint fdwCAPISettings;
uint fdwSecuritySettings;
uint dwIndex;
uint dwUnionChoice;
_Anonymous_e__Union Anonymous;
void* pClientData;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SIP_SUBJECTINFO サイズ: 80 バイト(x86)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pgSubjectType : GUID* (+4, 4byte) varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; hFile : HANDLE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; pwsFileName : LPWSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; pwsDisplayName : LPWSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwReserved1 : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwIntVersion : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; hProv : UINT_PTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; DigestAlgorithm : CRYPT_ALGORITHM_IDENTIFIER (+32, 12byte) varptr(st)+32 を基点に操作(12byte:入れ子/配列)
; dwFlags : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; dwEncodingType : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; dwReserved2 : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; fdwCAPISettings : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; fdwSecuritySettings : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; dwIndex : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; dwUnionChoice : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+72, 4byte) varptr(st)+72 を基点に操作(4byte:入れ子/配列)
; pClientData : void* (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SIP_SUBJECTINFO サイズ: 128 バイト(x64)
dim st, 32 ; 4byte整数×32(構造体サイズ 128 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pgSubjectType : GUID* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; hFile : HANDLE (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; pwsFileName : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pwsDisplayName : LPWSTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; dwReserved1 : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwIntVersion : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; hProv : UINT_PTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; DigestAlgorithm : CRYPT_ALGORITHM_IDENTIFIER (+56, 24byte) varptr(st)+56 を基点に操作(24byte:入れ子/配列)
; dwFlags : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; dwEncodingType : DWORD (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; dwReserved2 : DWORD (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; fdwCAPISettings : DWORD (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; fdwSecuritySettings : DWORD (+96, 4byte) st.24 = 値 / 値 = st.24 (lpoke/lpeek も可)
; dwIndex : DWORD (+100, 4byte) st.25 = 値 / 値 = st.25 (lpoke/lpeek も可)
; dwUnionChoice : DWORD (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+112, 8byte) varptr(st)+112 を基点に操作(8byte:入れ子/配列)
; pClientData : void* (+120, 8byte) qpoke st,120,値 / qpeek(st,120) ※IronHSPのみ。3.7/3.8は lpoke st,120,下位 : lpoke st,124,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global CRYPT_INTEGER_BLOB
#field int cbData
#field intptr pbData
#endstruct
#defstruct global CRYPT_ALGORITHM_IDENTIFIER
#field intptr pszObjId
#field CRYPT_INTEGER_BLOB Parameters
#endstruct
#defstruct global SIP_SUBJECTINFO
#field int cbSize
#field intptr pgSubjectType
#field intptr hFile
#field intptr pwsFileName
#field intptr pwsDisplayName
#field int dwReserved1
#field int dwIntVersion
#field intptr hProv
#field CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm
#field int dwFlags
#field int dwEncodingType
#field int dwReserved2
#field int fdwCAPISettings
#field int fdwSecuritySettings
#field int dwIndex
#field int dwUnionChoice
#field byte Anonymous 8
#field intptr pClientData
#endstruct
stdim st, SIP_SUBJECTINFO ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。