ホーム › Security.Cryptography › BCRYPT_DSA_PARAMETER_HEADER_V2
BCRYPT_DSA_PARAMETER_HEADER_V2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbLength | DWORD | 4 | +0 | +0 | このパラメータBLOB全体のバイト長。 |
| dwMagic | DWORD | 4 | +4 | +4 | V2 DSAパラメータBLOBを示すマジック値。BCRYPT_DSA_PARAMETERS_MAGIC_V2を格納する。 |
| cbKeyLength | DWORD | 4 | +8 | +8 | 鍵(モジュラスp)のバイト長。1024超の鍵長に対応する。 |
| hashAlgorithm | HASHALGORITHM_ENUM | 4 | +12 | +12 | パラメータ生成に用いるハッシュアルゴリズムの種別を示す列挙値。 |
| standardVersion | DSAFIPSVERSION_ENUM | 4 | +16 | +16 | 準拠するDSA FIPS標準の版を示す列挙値。FIPS 186-2/186-3を表す。 |
| cbSeedLength | DWORD | 4 | +20 | +20 | 鍵生成シードのバイト長。BLOB末尾のSeedの長さ。 |
| cbGroupSize | DWORD | 4 | +24 | +24 | 群位数qのバイト長。素数qの大きさを表す。 |
| Count | BYTE | 4 | +28 | +28 | 鍵生成カウンタ(4バイト、ビッグエンディアン)。素数生成試行回数を保持する。 |
各言語での定義
#include <windows.h>
// BCRYPT_DSA_PARAMETER_HEADER_V2 (x64 32 / x86 32 バイト)
typedef struct BCRYPT_DSA_PARAMETER_HEADER_V2 {
DWORD cbLength;
DWORD dwMagic;
DWORD cbKeyLength;
HASHALGORITHM_ENUM hashAlgorithm;
DSAFIPSVERSION_ENUM standardVersion;
DWORD cbSeedLength;
DWORD cbGroupSize;
BYTE Count[4];
} BCRYPT_DSA_PARAMETER_HEADER_V2;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BCRYPT_DSA_PARAMETER_HEADER_V2
{
public uint cbLength;
public uint dwMagic;
public uint cbKeyLength;
public int hashAlgorithm;
public int standardVersion;
public uint cbSeedLength;
public uint cbGroupSize;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] Count;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BCRYPT_DSA_PARAMETER_HEADER_V2
Public cbLength As UInteger
Public dwMagic As UInteger
Public cbKeyLength As UInteger
Public hashAlgorithm As Integer
Public standardVersion As Integer
Public cbSeedLength As UInteger
Public cbGroupSize As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public Count() As Byte
End Structureimport ctypes
from ctypes import wintypes
class BCRYPT_DSA_PARAMETER_HEADER_V2(ctypes.Structure):
_fields_ = [
("cbLength", wintypes.DWORD),
("dwMagic", wintypes.DWORD),
("cbKeyLength", wintypes.DWORD),
("hashAlgorithm", ctypes.c_int),
("standardVersion", ctypes.c_int),
("cbSeedLength", wintypes.DWORD),
("cbGroupSize", wintypes.DWORD),
("Count", ctypes.c_ubyte * 4),
]#[repr(C)]
pub struct BCRYPT_DSA_PARAMETER_HEADER_V2 {
pub cbLength: u32,
pub dwMagic: u32,
pub cbKeyLength: u32,
pub hashAlgorithm: i32,
pub standardVersion: i32,
pub cbSeedLength: u32,
pub cbGroupSize: u32,
pub Count: [u8; 4],
}import "golang.org/x/sys/windows"
type BCRYPT_DSA_PARAMETER_HEADER_V2 struct {
cbLength uint32
dwMagic uint32
cbKeyLength uint32
hashAlgorithm int32
standardVersion int32
cbSeedLength uint32
cbGroupSize uint32
Count [4]byte
}type
BCRYPT_DSA_PARAMETER_HEADER_V2 = record
cbLength: DWORD;
dwMagic: DWORD;
cbKeyLength: DWORD;
hashAlgorithm: Integer;
standardVersion: Integer;
cbSeedLength: DWORD;
cbGroupSize: DWORD;
Count: array[0..3] of Byte;
end;const BCRYPT_DSA_PARAMETER_HEADER_V2 = extern struct {
cbLength: u32,
dwMagic: u32,
cbKeyLength: u32,
hashAlgorithm: i32,
standardVersion: i32,
cbSeedLength: u32,
cbGroupSize: u32,
Count: [4]u8,
};type
BCRYPT_DSA_PARAMETER_HEADER_V2 {.bycopy.} = object
cbLength: uint32
dwMagic: uint32
cbKeyLength: uint32
hashAlgorithm: int32
standardVersion: int32
cbSeedLength: uint32
cbGroupSize: uint32
Count: array[4, uint8]struct BCRYPT_DSA_PARAMETER_HEADER_V2
{
uint cbLength;
uint dwMagic;
uint cbKeyLength;
int hashAlgorithm;
int standardVersion;
uint cbSeedLength;
uint cbGroupSize;
ubyte[4] Count;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BCRYPT_DSA_PARAMETER_HEADER_V2 サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 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 も可)
; hashAlgorithm : HASHALGORITHM_ENUM (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; standardVersion : DSAFIPSVERSION_ENUM (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; cbSeedLength : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; cbGroupSize : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; Count : BYTE (+28, 4byte) varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global BCRYPT_DSA_PARAMETER_HEADER_V2
#field int cbLength
#field int dwMagic
#field int cbKeyLength
#field int hashAlgorithm
#field int standardVersion
#field int cbSeedLength
#field int cbGroupSize
#field byte Count 4
#endstruct
stdim st, BCRYPT_DSA_PARAMETER_HEADER_V2 ; NSTRUCT 変数を確保
st->cbLength = 100
mes "cbLength=" + st->cbLength