ホーム › Security.Cryptography › SIGNER_PROVIDER_INFO
SIGNER_PROVIDER_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のバイト単位サイズ。呼び出し前に設定する。 |
| pwszProviderName | LPWSTR | 8/4 | +8 | +4 | 暗号化サービスプロバイダー(CSP)名のワイド文字列。 |
| dwProviderType | DWORD | 4 | +16 | +8 | プロバイダーの種別を示す値。 |
| dwKeySpec | DWORD | 4 | +20 | +12 | 使用する鍵の種別(署名用/交換用)を示す値。 |
| dwPvkChoice | SIGNER_PRIVATE_KEY_CHOICE | 4 | +24 | +16 | 秘密鍵の指定方法を示す列挙値。 |
| Anonymous | _Anonymous_e__Union | 8/4 | +32 | +20 | 選択方式に応じた秘密鍵情報を保持する無名共用体。 |
共用体: _Anonymous_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| pwszPvkFileName | LPWSTR | 8/4 | +0 | +0 |
| pwszKeyContainer | LPWSTR | 8/4 | +0 | +0 |
各言語での定義
#include <windows.h>
// SIGNER_PROVIDER_INFO (x64 40 / x86 24 バイト)
typedef struct SIGNER_PROVIDER_INFO {
DWORD cbSize;
LPWSTR pwszProviderName;
DWORD dwProviderType;
DWORD dwKeySpec;
SIGNER_PRIVATE_KEY_CHOICE dwPvkChoice;
_Anonymous_e__Union Anonymous;
} SIGNER_PROVIDER_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SIGNER_PROVIDER_INFO
{
public uint cbSize;
public IntPtr pwszProviderName;
public uint dwProviderType;
public uint dwKeySpec;
public uint dwPvkChoice;
public _Anonymous_e__Union Anonymous;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SIGNER_PROVIDER_INFO
Public cbSize As UInteger
Public pwszProviderName As IntPtr
Public dwProviderType As UInteger
Public dwKeySpec As UInteger
Public dwPvkChoice As UInteger
Public Anonymous As _Anonymous_e__Union
End Structureimport ctypes
from ctypes import wintypes
class SIGNER_PROVIDER_INFO(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("pwszProviderName", ctypes.c_void_p),
("dwProviderType", wintypes.DWORD),
("dwKeySpec", wintypes.DWORD),
("dwPvkChoice", wintypes.DWORD),
("Anonymous", _Anonymous_e__Union),
]#[repr(C)]
pub struct SIGNER_PROVIDER_INFO {
pub cbSize: u32,
pub pwszProviderName: *mut core::ffi::c_void,
pub dwProviderType: u32,
pub dwKeySpec: u32,
pub dwPvkChoice: u32,
pub Anonymous: _Anonymous_e__Union,
}import "golang.org/x/sys/windows"
type SIGNER_PROVIDER_INFO struct {
cbSize uint32
pwszProviderName uintptr
dwProviderType uint32
dwKeySpec uint32
dwPvkChoice uint32
Anonymous _Anonymous_e__Union
}type
SIGNER_PROVIDER_INFO = record
cbSize: DWORD;
pwszProviderName: Pointer;
dwProviderType: DWORD;
dwKeySpec: DWORD;
dwPvkChoice: DWORD;
Anonymous: _Anonymous_e__Union;
end;const SIGNER_PROVIDER_INFO = extern struct {
cbSize: u32,
pwszProviderName: ?*anyopaque,
dwProviderType: u32,
dwKeySpec: u32,
dwPvkChoice: u32,
Anonymous: _Anonymous_e__Union,
};type
SIGNER_PROVIDER_INFO {.bycopy.} = object
cbSize: uint32
pwszProviderName: pointer
dwProviderType: uint32
dwKeySpec: uint32
dwPvkChoice: uint32
Anonymous: _Anonymous_e__Unionstruct SIGNER_PROVIDER_INFO
{
uint cbSize;
void* pwszProviderName;
uint dwProviderType;
uint dwKeySpec;
uint dwPvkChoice;
_Anonymous_e__Union Anonymous;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SIGNER_PROVIDER_INFO サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pwszProviderName : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwProviderType : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwKeySpec : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwPvkChoice : SIGNER_PRIVATE_KEY_CHOICE (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+20, 4byte) varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SIGNER_PROVIDER_INFO サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pwszProviderName : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; dwProviderType : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwKeySpec : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwPvkChoice : SIGNER_PRIVATE_KEY_CHOICE (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SIGNER_PROVIDER_INFO
#field int cbSize
#field intptr pwszProviderName
#field int dwProviderType
#field int dwKeySpec
#field int dwPvkChoice
#field byte Anonymous 8
#endstruct
stdim st, SIGNER_PROVIDER_INFO ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。