ホーム › Security.Cryptography › CARD_DH_AGREEMENT_INFO
CARD_DH_AGREEMENT_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwVersion | DWORD | 4 | +0 | +0 | DH鍵共有情報構造体のバージョン番号。 |
| bContainerIndex | BYTE | 1 | +4 | +4 | 対象鍵コンテナのインデックス。 |
| dwFlags | DWORD | 4 | +8 | +8 | 鍵共有処理の動作を制御するフラグ。 |
| dwPublicKey | DWORD | 4 | +12 | +12 | 相手公開鍵データのバイト長。 |
| pbPublicKey | BYTE* | 8/4 | +16 | +16 | 相手公開鍵データへのポインタ。 |
| pbReserved | BYTE* | 8/4 | +24 | +20 | 予約バイト列へのポインタ。NULL可。 |
| cbReserved | DWORD | 4 | +32 | +24 | 予約バイト列のバイト長。 |
| bSecretAgreementIndex | BYTE | 1 | +36 | +28 | 生成された共有秘密のインデックス。 |
各言語での定義
#include <windows.h>
// CARD_DH_AGREEMENT_INFO (x64 40 / x86 32 バイト)
typedef struct CARD_DH_AGREEMENT_INFO {
DWORD dwVersion;
BYTE bContainerIndex;
DWORD dwFlags;
DWORD dwPublicKey;
BYTE* pbPublicKey;
BYTE* pbReserved;
DWORD cbReserved;
BYTE bSecretAgreementIndex;
} CARD_DH_AGREEMENT_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CARD_DH_AGREEMENT_INFO
{
public uint dwVersion;
public byte bContainerIndex;
public uint dwFlags;
public uint dwPublicKey;
public IntPtr pbPublicKey;
public IntPtr pbReserved;
public uint cbReserved;
public byte bSecretAgreementIndex;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CARD_DH_AGREEMENT_INFO
Public dwVersion As UInteger
Public bContainerIndex As Byte
Public dwFlags As UInteger
Public dwPublicKey As UInteger
Public pbPublicKey As IntPtr
Public pbReserved As IntPtr
Public cbReserved As UInteger
Public bSecretAgreementIndex As Byte
End Structureimport ctypes
from ctypes import wintypes
class CARD_DH_AGREEMENT_INFO(ctypes.Structure):
_fields_ = [
("dwVersion", wintypes.DWORD),
("bContainerIndex", ctypes.c_ubyte),
("dwFlags", wintypes.DWORD),
("dwPublicKey", wintypes.DWORD),
("pbPublicKey", ctypes.c_void_p),
("pbReserved", ctypes.c_void_p),
("cbReserved", wintypes.DWORD),
("bSecretAgreementIndex", ctypes.c_ubyte),
]#[repr(C)]
pub struct CARD_DH_AGREEMENT_INFO {
pub dwVersion: u32,
pub bContainerIndex: u8,
pub dwFlags: u32,
pub dwPublicKey: u32,
pub pbPublicKey: *mut core::ffi::c_void,
pub pbReserved: *mut core::ffi::c_void,
pub cbReserved: u32,
pub bSecretAgreementIndex: u8,
}import "golang.org/x/sys/windows"
type CARD_DH_AGREEMENT_INFO struct {
dwVersion uint32
bContainerIndex byte
dwFlags uint32
dwPublicKey uint32
pbPublicKey uintptr
pbReserved uintptr
cbReserved uint32
bSecretAgreementIndex byte
}type
CARD_DH_AGREEMENT_INFO = record
dwVersion: DWORD;
bContainerIndex: Byte;
dwFlags: DWORD;
dwPublicKey: DWORD;
pbPublicKey: Pointer;
pbReserved: Pointer;
cbReserved: DWORD;
bSecretAgreementIndex: Byte;
end;const CARD_DH_AGREEMENT_INFO = extern struct {
dwVersion: u32,
bContainerIndex: u8,
dwFlags: u32,
dwPublicKey: u32,
pbPublicKey: ?*anyopaque,
pbReserved: ?*anyopaque,
cbReserved: u32,
bSecretAgreementIndex: u8,
};type
CARD_DH_AGREEMENT_INFO {.bycopy.} = object
dwVersion: uint32
bContainerIndex: uint8
dwFlags: uint32
dwPublicKey: uint32
pbPublicKey: pointer
pbReserved: pointer
cbReserved: uint32
bSecretAgreementIndex: uint8struct CARD_DH_AGREEMENT_INFO
{
uint dwVersion;
ubyte bContainerIndex;
uint dwFlags;
uint dwPublicKey;
void* pbPublicKey;
void* pbReserved;
uint cbReserved;
ubyte bSecretAgreementIndex;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CARD_DH_AGREEMENT_INFO サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; bContainerIndex : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; dwFlags : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwPublicKey : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; pbPublicKey : BYTE* (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; pbReserved : BYTE* (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; cbReserved : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; bSecretAgreementIndex : BYTE (+28, 1byte) poke st,28,値 / 値 = peek(st,28)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CARD_DH_AGREEMENT_INFO サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; bContainerIndex : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; dwFlags : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwPublicKey : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; pbPublicKey : BYTE* (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; pbReserved : BYTE* (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; cbReserved : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; bSecretAgreementIndex : BYTE (+36, 1byte) poke st,36,値 / 値 = peek(st,36)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CARD_DH_AGREEMENT_INFO
#field int dwVersion
#field byte bContainerIndex
#field int dwFlags
#field int dwPublicKey
#field intptr pbPublicKey
#field intptr pbReserved
#field int cbReserved
#field byte bSecretAgreementIndex
#endstruct
stdim st, CARD_DH_AGREEMENT_INFO ; NSTRUCT 変数を確保
st->dwVersion = 100
mes "dwVersion=" + st->dwVersion