Win32 API 日本語リファレンス
ホームSecurity.Cryptography › NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE

NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE

構造体
サイズx64: 32 バイト / x86: 32 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
HeaderNCRYPT_EXPORTED_ISOLATED_KEY_HEADER32+0+0エクスポート分離鍵のヘッダー(NCRYPT_EXPORTED_ISOLATED_KEY_HEADER)。後続データの構成情報を保持する。

各言語での定義

#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;

// NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE  (x64 32 / x86 32 バイト)
typedef struct NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE {
    NCRYPT_EXPORTED_ISOLATED_KEY_HEADER Header;
} NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE;
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;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE
{
    public NCRYPT_EXPORTED_ISOLATED_KEY_HEADER Header;
}
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 Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE
    Public Header As NCRYPT_EXPORTED_ISOLATED_KEY_HEADER
End Structure
import 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),
    ]

class NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE(ctypes.Structure):
    _fields_ = [
        ("Header", NCRYPT_EXPORTED_ISOLATED_KEY_HEADER),
    ]
#[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,
}

#[repr(C)]
pub struct NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE {
    pub Header: NCRYPT_EXPORTED_ISOLATED_KEY_HEADER,
}
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_ENVELOPE struct {
	Header NCRYPT_EXPORTED_ISOLATED_KEY_HEADER
}
type
  NCRYPT_EXPORTED_ISOLATED_KEY_HEADER = record
    Version: DWORD;
    KeyUsage: DWORD;
    _bitfield: DWORD;
    cbAlgName: DWORD;
    cbNonce: DWORD;
    cbAuthTag: DWORD;
    cbWrappingKey: DWORD;
    cbIsolatedKey: DWORD;
  end;

  NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE = record
    Header: NCRYPT_EXPORTED_ISOLATED_KEY_HEADER;
  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,
};

const NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE = extern struct {
    Header: NCRYPT_EXPORTED_ISOLATED_KEY_HEADER,
};
type
  NCRYPT_EXPORTED_ISOLATED_KEY_HEADER {.bycopy.} = object
    Version: uint32
    KeyUsage: uint32
    _bitfield: uint32
    cbAlgName: uint32
    cbNonce: uint32
    cbAuthTag: uint32
    cbWrappingKey: uint32
    cbIsolatedKey: uint32

  NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE {.bycopy.} = object
    Header: NCRYPT_EXPORTED_ISOLATED_KEY_HEADER
struct NCRYPT_EXPORTED_ISOLATED_KEY_HEADER
{
    uint Version;
    uint KeyUsage;
    uint _bitfield;
    uint cbAlgName;
    uint cbNonce;
    uint cbAuthTag;
    uint cbWrappingKey;
    uint cbIsolatedKey;
}

struct NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE
{
    NCRYPT_EXPORTED_ISOLATED_KEY_HEADER Header;
}

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_ENVELOPE サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Header : NCRYPT_EXPORTED_ISOLATED_KEY_HEADER (+0, 32byte)  varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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

#defstruct global NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE
    #field NCRYPT_EXPORTED_ISOLATED_KEY_HEADER Header
#endstruct

stdim st, NCRYPT_EXPORTED_ISOLATED_KEY_ENVELOPE        ; NSTRUCT 変数を確保