ホーム › Security.Cryptography › NCRYPT_CIPHER_PADDING_INFO
NCRYPT_CIPHER_PADDING_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のバイト長。 |
| dwFlags | DWORD | 4 | +4 | +4 | 暗号パディングに関するフラグ。現状は予約され通常0。 |
| pbIV | BYTE* | 8/4 | +8 | +8 | 初期化ベクター(IV)データへのポインタ。不要な場合はNULL。 |
| cbIV | DWORD | 4 | +16 | +12 | pbIVが指すIVのバイト長。 |
| pbOtherInfo | BYTE* | 8/4 | +24 | +16 | 追加情報(AAD等)データへのポインタ。不要な場合はNULL。 |
| cbOtherInfo | DWORD | 4 | +32 | +20 | pbOtherInfoが指すデータのバイト長。 |
各言語での定義
#include <windows.h>
// NCRYPT_CIPHER_PADDING_INFO (x64 40 / x86 24 バイト)
typedef struct NCRYPT_CIPHER_PADDING_INFO {
DWORD cbSize;
DWORD dwFlags;
BYTE* pbIV;
DWORD cbIV;
BYTE* pbOtherInfo;
DWORD cbOtherInfo;
} NCRYPT_CIPHER_PADDING_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NCRYPT_CIPHER_PADDING_INFO
{
public uint cbSize;
public uint dwFlags;
public IntPtr pbIV;
public uint cbIV;
public IntPtr pbOtherInfo;
public uint cbOtherInfo;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NCRYPT_CIPHER_PADDING_INFO
Public cbSize As UInteger
Public dwFlags As UInteger
Public pbIV As IntPtr
Public cbIV As UInteger
Public pbOtherInfo As IntPtr
Public cbOtherInfo As UInteger
End Structureimport ctypes
from ctypes import wintypes
class NCRYPT_CIPHER_PADDING_INFO(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("dwFlags", wintypes.DWORD),
("pbIV", ctypes.c_void_p),
("cbIV", wintypes.DWORD),
("pbOtherInfo", ctypes.c_void_p),
("cbOtherInfo", wintypes.DWORD),
]#[repr(C)]
pub struct NCRYPT_CIPHER_PADDING_INFO {
pub cbSize: u32,
pub dwFlags: u32,
pub pbIV: *mut core::ffi::c_void,
pub cbIV: u32,
pub pbOtherInfo: *mut core::ffi::c_void,
pub cbOtherInfo: u32,
}import "golang.org/x/sys/windows"
type NCRYPT_CIPHER_PADDING_INFO struct {
cbSize uint32
dwFlags uint32
pbIV uintptr
cbIV uint32
pbOtherInfo uintptr
cbOtherInfo uint32
}type
NCRYPT_CIPHER_PADDING_INFO = record
cbSize: DWORD;
dwFlags: DWORD;
pbIV: Pointer;
cbIV: DWORD;
pbOtherInfo: Pointer;
cbOtherInfo: DWORD;
end;const NCRYPT_CIPHER_PADDING_INFO = extern struct {
cbSize: u32,
dwFlags: u32,
pbIV: ?*anyopaque,
cbIV: u32,
pbOtherInfo: ?*anyopaque,
cbOtherInfo: u32,
};type
NCRYPT_CIPHER_PADDING_INFO {.bycopy.} = object
cbSize: uint32
dwFlags: uint32
pbIV: pointer
cbIV: uint32
pbOtherInfo: pointer
cbOtherInfo: uint32struct NCRYPT_CIPHER_PADDING_INFO
{
uint cbSize;
uint dwFlags;
void* pbIV;
uint cbIV;
void* pbOtherInfo;
uint cbOtherInfo;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NCRYPT_CIPHER_PADDING_INFO サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pbIV : BYTE* (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cbIV : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; pbOtherInfo : BYTE* (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; cbOtherInfo : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NCRYPT_CIPHER_PADDING_INFO サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pbIV : BYTE* (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; cbIV : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; pbOtherInfo : BYTE* (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; cbOtherInfo : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NCRYPT_CIPHER_PADDING_INFO
#field int cbSize
#field int dwFlags
#field intptr pbIV
#field int cbIV
#field intptr pbOtherInfo
#field int cbOtherInfo
#endstruct
stdim st, NCRYPT_CIPHER_PADDING_INFO ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize