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

SecPkgContext_NegoKeys

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

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

フィールド

フィールドサイズx64x86説明
KeyTypeDWORD4+0+0ネゴシエートされた暗号化鍵の種別を示す値。
KeyLengthWORD2+4+4KeyValueが指す鍵の長さ(バイト数)。
KeyValueBYTE*8/4+8+8ネゴシエートされた暗号化鍵データを指すバイト配列ポインタ。
VerifyKeyTypeDWORD4+16+12検証用鍵の種別を示す値。
VerifyKeyLengthWORD2+20+16VerifyKeyValueが指す検証用鍵の長さ(バイト数)。
VerifyKeyValueBYTE*8/4+24+20署名検証に用いる鍵データを指すバイト配列ポインタ。

各言語での定義

#include <windows.h>

// SecPkgContext_NegoKeys  (x64 32 / x86 24 バイト)
typedef struct SecPkgContext_NegoKeys {
    DWORD KeyType;
    WORD KeyLength;
    BYTE* KeyValue;
    DWORD VerifyKeyType;
    WORD VerifyKeyLength;
    BYTE* VerifyKeyValue;
} SecPkgContext_NegoKeys;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SecPkgContext_NegoKeys
{
    public uint KeyType;
    public ushort KeyLength;
    public IntPtr KeyValue;
    public uint VerifyKeyType;
    public ushort VerifyKeyLength;
    public IntPtr VerifyKeyValue;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SecPkgContext_NegoKeys
    Public KeyType As UInteger
    Public KeyLength As UShort
    Public KeyValue As IntPtr
    Public VerifyKeyType As UInteger
    Public VerifyKeyLength As UShort
    Public VerifyKeyValue As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class SecPkgContext_NegoKeys(ctypes.Structure):
    _fields_ = [
        ("KeyType", wintypes.DWORD),
        ("KeyLength", ctypes.c_ushort),
        ("KeyValue", ctypes.c_void_p),
        ("VerifyKeyType", wintypes.DWORD),
        ("VerifyKeyLength", ctypes.c_ushort),
        ("VerifyKeyValue", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct SecPkgContext_NegoKeys {
    pub KeyType: u32,
    pub KeyLength: u16,
    pub KeyValue: *mut core::ffi::c_void,
    pub VerifyKeyType: u32,
    pub VerifyKeyLength: u16,
    pub VerifyKeyValue: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type SecPkgContext_NegoKeys struct {
	KeyType uint32
	KeyLength uint16
	KeyValue uintptr
	VerifyKeyType uint32
	VerifyKeyLength uint16
	VerifyKeyValue uintptr
}
type
  SecPkgContext_NegoKeys = record
    KeyType: DWORD;
    KeyLength: Word;
    KeyValue: Pointer;
    VerifyKeyType: DWORD;
    VerifyKeyLength: Word;
    VerifyKeyValue: Pointer;
  end;
const SecPkgContext_NegoKeys = extern struct {
    KeyType: u32,
    KeyLength: u16,
    KeyValue: ?*anyopaque,
    VerifyKeyType: u32,
    VerifyKeyLength: u16,
    VerifyKeyValue: ?*anyopaque,
};
type
  SecPkgContext_NegoKeys {.bycopy.} = object
    KeyType: uint32
    KeyLength: uint16
    KeyValue: pointer
    VerifyKeyType: uint32
    VerifyKeyLength: uint16
    VerifyKeyValue: pointer
struct SecPkgContext_NegoKeys
{
    uint KeyType;
    ushort KeyLength;
    void* KeyValue;
    uint VerifyKeyType;
    ushort VerifyKeyLength;
    void* VerifyKeyValue;
}

HSP用 定義

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

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

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