ホーム › Security.Cryptography › NCRYPT_EXPORTED_ISOLATED_KEY_HEADER
NCRYPT_EXPORTED_ISOLATED_KEY_HEADER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | エクスポートされた分離鍵ヘッダーのバージョン番号。 |
| KeyUsage | DWORD | 4 | +4 | +4 | 鍵の用途を示す値。署名や暗号化などの許可操作を表す。 |
| _bitfield | DWORD | 4 | +8 | +8 | ビットフィールド。各種フラグをパックして保持する内部用フィールド。 |
| cbAlgName | DWORD | 4 | +12 | +12 | アルゴリズム名文字列のバイト長。 |
| cbNonce | DWORD | 4 | +16 | +16 | ノンス(使い捨て乱数)データのバイト長。 |
| cbAuthTag | DWORD | 4 | +20 | +20 | 認証タグ(AEADの完全性検証用)のバイト長。 |
| cbWrappingKey | DWORD | 4 | +24 | +24 | ラッピング鍵データのバイト長。 |
| cbIsolatedKey | DWORD | 4 | +28 | +28 | 分離鍵本体データのバイト長。 |
各言語での定義
#include <windows.h>
// NCRYPT_EXPORTED_ISOLATED_KEY_HEADER (x64 32 / x86 32 バイト)
typedef struct NCRYPT_EXPORTED_ISOLATED_KEY_HEADER {
DWORD Version;
DWORD KeyUsage;
DWORD _bitfield;
DWORD cbAlgName;
DWORD cbNonce;
DWORD cbAuthTag;
DWORD cbWrappingKey;
DWORD cbIsolatedKey;
} NCRYPT_EXPORTED_ISOLATED_KEY_HEADER;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NCRYPT_EXPORTED_ISOLATED_KEY_HEADER
{
public uint Version;
public uint KeyUsage;
public uint _bitfield;
public uint cbAlgName;
public uint cbNonce;
public uint cbAuthTag;
public uint cbWrappingKey;
public uint cbIsolatedKey;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NCRYPT_EXPORTED_ISOLATED_KEY_HEADER
Public Version As UInteger
Public KeyUsage As UInteger
Public _bitfield As UInteger
Public cbAlgName As UInteger
Public cbNonce As UInteger
Public cbAuthTag As UInteger
Public cbWrappingKey As UInteger
Public cbIsolatedKey As UInteger
End Structureimport ctypes
from ctypes import wintypes
class NCRYPT_EXPORTED_ISOLATED_KEY_HEADER(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("KeyUsage", wintypes.DWORD),
("_bitfield", wintypes.DWORD),
("cbAlgName", wintypes.DWORD),
("cbNonce", wintypes.DWORD),
("cbAuthTag", wintypes.DWORD),
("cbWrappingKey", wintypes.DWORD),
("cbIsolatedKey", wintypes.DWORD),
]#[repr(C)]
pub struct NCRYPT_EXPORTED_ISOLATED_KEY_HEADER {
pub Version: u32,
pub KeyUsage: u32,
pub _bitfield: u32,
pub cbAlgName: u32,
pub cbNonce: u32,
pub cbAuthTag: u32,
pub cbWrappingKey: u32,
pub cbIsolatedKey: u32,
}import "golang.org/x/sys/windows"
type NCRYPT_EXPORTED_ISOLATED_KEY_HEADER struct {
Version uint32
KeyUsage uint32
_bitfield uint32
cbAlgName uint32
cbNonce uint32
cbAuthTag uint32
cbWrappingKey uint32
cbIsolatedKey uint32
}type
NCRYPT_EXPORTED_ISOLATED_KEY_HEADER = record
Version: DWORD;
KeyUsage: DWORD;
_bitfield: DWORD;
cbAlgName: DWORD;
cbNonce: DWORD;
cbAuthTag: DWORD;
cbWrappingKey: DWORD;
cbIsolatedKey: DWORD;
end;const NCRYPT_EXPORTED_ISOLATED_KEY_HEADER = extern struct {
Version: u32,
KeyUsage: u32,
_bitfield: u32,
cbAlgName: u32,
cbNonce: u32,
cbAuthTag: u32,
cbWrappingKey: u32,
cbIsolatedKey: u32,
};type
NCRYPT_EXPORTED_ISOLATED_KEY_HEADER {.bycopy.} = object
Version: uint32
KeyUsage: uint32
_bitfield: uint32
cbAlgName: uint32
cbNonce: uint32
cbAuthTag: uint32
cbWrappingKey: uint32
cbIsolatedKey: uint32struct NCRYPT_EXPORTED_ISOLATED_KEY_HEADER
{
uint Version;
uint KeyUsage;
uint _bitfield;
uint cbAlgName;
uint cbNonce;
uint cbAuthTag;
uint cbWrappingKey;
uint cbIsolatedKey;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NCRYPT_EXPORTED_ISOLATED_KEY_HEADER サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Version : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; KeyUsage : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; _bitfield : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cbAlgName : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; cbNonce : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; cbAuthTag : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; cbWrappingKey : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; cbIsolatedKey : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NCRYPT_EXPORTED_ISOLATED_KEY_HEADER
#field int Version
#field int KeyUsage
#field int _bitfield
#field int cbAlgName
#field int cbNonce
#field int cbAuthTag
#field int cbWrappingKey
#field int cbIsolatedKey
#endstruct
stdim st, NCRYPT_EXPORTED_ISOLATED_KEY_HEADER ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version