ホーム › Security.Cryptography › BCRYPT_DH_PARAMETER_HEADER
BCRYPT_DH_PARAMETER_HEADER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbLength | DWORD | 4 | +0 | +0 | パラメーター全体(ヘッダー含む)のバイト長。 |
| dwMagic | DWORD | 4 | +4 | +4 | DHパラメーターBLOBの種別を示すマジック値。 |
| cbKeyLength | DWORD | 4 | +8 | +8 | 鍵成分のバイト長。 |
各言語での定義
#include <windows.h>
// BCRYPT_DH_PARAMETER_HEADER (x64 12 / x86 12 バイト)
typedef struct BCRYPT_DH_PARAMETER_HEADER {
DWORD cbLength;
DWORD dwMagic;
DWORD cbKeyLength;
} BCRYPT_DH_PARAMETER_HEADER;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BCRYPT_DH_PARAMETER_HEADER
{
public uint cbLength;
public uint dwMagic;
public uint cbKeyLength;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BCRYPT_DH_PARAMETER_HEADER
Public cbLength As UInteger
Public dwMagic As UInteger
Public cbKeyLength As UInteger
End Structureimport ctypes
from ctypes import wintypes
class BCRYPT_DH_PARAMETER_HEADER(ctypes.Structure):
_fields_ = [
("cbLength", wintypes.DWORD),
("dwMagic", wintypes.DWORD),
("cbKeyLength", wintypes.DWORD),
]#[repr(C)]
pub struct BCRYPT_DH_PARAMETER_HEADER {
pub cbLength: u32,
pub dwMagic: u32,
pub cbKeyLength: u32,
}import "golang.org/x/sys/windows"
type BCRYPT_DH_PARAMETER_HEADER struct {
cbLength uint32
dwMagic uint32
cbKeyLength uint32
}type
BCRYPT_DH_PARAMETER_HEADER = record
cbLength: DWORD;
dwMagic: DWORD;
cbKeyLength: DWORD;
end;const BCRYPT_DH_PARAMETER_HEADER = extern struct {
cbLength: u32,
dwMagic: u32,
cbKeyLength: u32,
};type
BCRYPT_DH_PARAMETER_HEADER {.bycopy.} = object
cbLength: uint32
dwMagic: uint32
cbKeyLength: uint32struct BCRYPT_DH_PARAMETER_HEADER
{
uint cbLength;
uint dwMagic;
uint cbKeyLength;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BCRYPT_DH_PARAMETER_HEADER サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; cbLength : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwMagic : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; cbKeyLength : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global BCRYPT_DH_PARAMETER_HEADER
#field int cbLength
#field int dwMagic
#field int cbKeyLength
#endstruct
stdim st, BCRYPT_DH_PARAMETER_HEADER ; NSTRUCT 変数を確保
st->cbLength = 100
mes "cbLength=" + st->cbLength