Win32 API 日本語リファレンス
ホームSecurity.Authentication.Identity › KERB_CRYPTO_KEY

KERB_CRYPTO_KEY

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

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

フィールド

フィールドサイズx64x86説明
KeyTypeKERB_CRYPTO_KEY_TYPE4+0+0暗号鍵の種類(暗号化方式)を示す列挙値。
LengthDWORD4+4+4Valueのバイト長。
ValueBYTE*8/4+8+8暗号鍵本体の生データへのポインタ。

各言語での定義

#include <windows.h>

// KERB_CRYPTO_KEY  (x64 16 / x86 12 バイト)
typedef struct KERB_CRYPTO_KEY {
    KERB_CRYPTO_KEY_TYPE KeyType;
    DWORD Length;
    BYTE* Value;
} KERB_CRYPTO_KEY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KERB_CRYPTO_KEY
{
    public int KeyType;
    public uint Length;
    public IntPtr Value;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KERB_CRYPTO_KEY
    Public KeyType As Integer
    Public Length As UInteger
    Public Value As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class KERB_CRYPTO_KEY(ctypes.Structure):
    _fields_ = [
        ("KeyType", ctypes.c_int),
        ("Length", wintypes.DWORD),
        ("Value", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct KERB_CRYPTO_KEY {
    pub KeyType: i32,
    pub Length: u32,
    pub Value: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type KERB_CRYPTO_KEY struct {
	KeyType int32
	Length uint32
	Value uintptr
}
type
  KERB_CRYPTO_KEY = record
    KeyType: Integer;
    Length: DWORD;
    Value: Pointer;
  end;
const KERB_CRYPTO_KEY = extern struct {
    KeyType: i32,
    Length: u32,
    Value: ?*anyopaque,
};
type
  KERB_CRYPTO_KEY {.bycopy.} = object
    KeyType: int32
    Length: uint32
    Value: pointer
struct KERB_CRYPTO_KEY
{
    int KeyType;
    uint Length;
    void* Value;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; KERB_CRYPTO_KEY サイズ: 12 バイト(x86)
dim st, 3    ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; KeyType : KERB_CRYPTO_KEY_TYPE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Length : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Value : BYTE* (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KERB_CRYPTO_KEY サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; KeyType : KERB_CRYPTO_KEY_TYPE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Length : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Value : BYTE* (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global KERB_CRYPTO_KEY
    #field int KeyType
    #field int Length
    #field intptr Value
#endstruct

stdim st, KERB_CRYPTO_KEY        ; NSTRUCT 変数を確保
st->KeyType = 100
mes "KeyType=" + st->KeyType