SEC_CHANNEL_BINDINGS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwInitiatorAddrType | DWORD | 4 | +0 | +0 | クライアントに対して指定されたアドレスの種類 (HTTP など)。 |
| cbInitiatorLength | DWORD | 4 | +4 | +4 | クライアントのアドレスを指定するデータのサイズ (バイト単位)。 |
| dwInitiatorOffset | DWORD | 4 | +8 | +8 | この構造体の先頭から、クライアントのアドレスを指定するデータの先頭までのバイト数。 |
| dwAcceptorAddrType | DWORD | 4 | +12 | +12 | サーバーに対して指定されたアドレスの種類 (SPN など)。 |
| cbAcceptorLength | DWORD | 4 | +16 | +16 | サーバーのアドレスを指定するデータのサイズ (バイト単位)。 |
| dwAcceptorOffset | DWORD | 4 | +20 | +20 | この構造体の先頭から、サーバーのアドレスを指定するデータの先頭までのバイト数。 |
| cbApplicationDataLength | DWORD | 4 | +24 | +24 | チャネルバインディングデータのサイズ (バイト単位)。 |
| dwApplicationDataOffset | DWORD | 4 | +28 | +28 | この構造体のサイズ (バイト単位)。チャネルバインディングデータは、この構造体の直後に続きます。 |
公式ドキュメント
セキュリティコンテキストのチャネルバインディング情報を指定します。
解説(Remarks)
Schannel は、cbApplicationDataLength と dwApplicationDataOffset 以外の、この構造体のすべてのメンバーの値を 0 に設定します。
Schannel 以外のセキュリティサポートプロバイダー (SSP) は、QueryContextAttributes (Schannel) 関数の呼び出しによって取得したこの構造体の値を、SECBUFFER_CHANNEL_BINDINGS 型の SecBuffer 構造体として、AcceptSecurityContext (General) 関数の呼び出しにおける pInput パラメーターのバッファーの 1 つとして渡してください。
Schannel 以外のセキュリティサポートプロバイダー (SSP) は、クライアントが認証に使用した Schannel コンテキストに対して QueryContextAttributes (Schannel) 関数を呼び出すことで、この構造体が指定するチャネルバインディング情報を取得してください。このチャネルバインディング情報は、SECBUFFER_CHANNEL_BINDINGS 型の SecBuffer 構造体として、AcceptSecurityContext (General) 関数の呼び出しにおける pInput パラメーターに渡します。
QueryContextAttributes (Schannel) 関数の ulAttribute パラメーターの値が SECPKG_ATTR_UNIQUE_BINDINGS の場合、この構造体が指定するチャネルバインディングデータは "tls-unique:" で始まります。
QueryContextAttributes (Schannel) 関数の ulAttribute パラメーターの値が SECPKG_ATTR_ENDPOINT_BINDINGS の場合、この構造体が指定するチャネルバインディングデータは "tls-server-end-point:" で始まります。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// SEC_CHANNEL_BINDINGS (x64 32 / x86 32 バイト)
typedef struct SEC_CHANNEL_BINDINGS {
DWORD dwInitiatorAddrType;
DWORD cbInitiatorLength;
DWORD dwInitiatorOffset;
DWORD dwAcceptorAddrType;
DWORD cbAcceptorLength;
DWORD dwAcceptorOffset;
DWORD cbApplicationDataLength;
DWORD dwApplicationDataOffset;
} SEC_CHANNEL_BINDINGS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SEC_CHANNEL_BINDINGS
{
public uint dwInitiatorAddrType;
public uint cbInitiatorLength;
public uint dwInitiatorOffset;
public uint dwAcceptorAddrType;
public uint cbAcceptorLength;
public uint dwAcceptorOffset;
public uint cbApplicationDataLength;
public uint dwApplicationDataOffset;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SEC_CHANNEL_BINDINGS
Public dwInitiatorAddrType As UInteger
Public cbInitiatorLength As UInteger
Public dwInitiatorOffset As UInteger
Public dwAcceptorAddrType As UInteger
Public cbAcceptorLength As UInteger
Public dwAcceptorOffset As UInteger
Public cbApplicationDataLength As UInteger
Public dwApplicationDataOffset As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SEC_CHANNEL_BINDINGS(ctypes.Structure):
_fields_ = [
("dwInitiatorAddrType", wintypes.DWORD),
("cbInitiatorLength", wintypes.DWORD),
("dwInitiatorOffset", wintypes.DWORD),
("dwAcceptorAddrType", wintypes.DWORD),
("cbAcceptorLength", wintypes.DWORD),
("dwAcceptorOffset", wintypes.DWORD),
("cbApplicationDataLength", wintypes.DWORD),
("dwApplicationDataOffset", wintypes.DWORD),
]#[repr(C)]
pub struct SEC_CHANNEL_BINDINGS {
pub dwInitiatorAddrType: u32,
pub cbInitiatorLength: u32,
pub dwInitiatorOffset: u32,
pub dwAcceptorAddrType: u32,
pub cbAcceptorLength: u32,
pub dwAcceptorOffset: u32,
pub cbApplicationDataLength: u32,
pub dwApplicationDataOffset: u32,
}import "golang.org/x/sys/windows"
type SEC_CHANNEL_BINDINGS struct {
dwInitiatorAddrType uint32
cbInitiatorLength uint32
dwInitiatorOffset uint32
dwAcceptorAddrType uint32
cbAcceptorLength uint32
dwAcceptorOffset uint32
cbApplicationDataLength uint32
dwApplicationDataOffset uint32
}type
SEC_CHANNEL_BINDINGS = record
dwInitiatorAddrType: DWORD;
cbInitiatorLength: DWORD;
dwInitiatorOffset: DWORD;
dwAcceptorAddrType: DWORD;
cbAcceptorLength: DWORD;
dwAcceptorOffset: DWORD;
cbApplicationDataLength: DWORD;
dwApplicationDataOffset: DWORD;
end;const SEC_CHANNEL_BINDINGS = extern struct {
dwInitiatorAddrType: u32,
cbInitiatorLength: u32,
dwInitiatorOffset: u32,
dwAcceptorAddrType: u32,
cbAcceptorLength: u32,
dwAcceptorOffset: u32,
cbApplicationDataLength: u32,
dwApplicationDataOffset: u32,
};type
SEC_CHANNEL_BINDINGS {.bycopy.} = object
dwInitiatorAddrType: uint32
cbInitiatorLength: uint32
dwInitiatorOffset: uint32
dwAcceptorAddrType: uint32
cbAcceptorLength: uint32
dwAcceptorOffset: uint32
cbApplicationDataLength: uint32
dwApplicationDataOffset: uint32struct SEC_CHANNEL_BINDINGS
{
uint dwInitiatorAddrType;
uint cbInitiatorLength;
uint dwInitiatorOffset;
uint dwAcceptorAddrType;
uint cbAcceptorLength;
uint dwAcceptorOffset;
uint cbApplicationDataLength;
uint dwApplicationDataOffset;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SEC_CHANNEL_BINDINGS サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; dwInitiatorAddrType : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; cbInitiatorLength : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwInitiatorOffset : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwAcceptorAddrType : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; cbAcceptorLength : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwAcceptorOffset : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; cbApplicationDataLength : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwApplicationDataOffset : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SEC_CHANNEL_BINDINGS
#field int dwInitiatorAddrType
#field int cbInitiatorLength
#field int dwInitiatorOffset
#field int dwAcceptorAddrType
#field int cbAcceptorLength
#field int dwAcceptorOffset
#field int cbApplicationDataLength
#field int dwApplicationDataOffset
#endstruct
stdim st, SEC_CHANNEL_BINDINGS ; NSTRUCT 変数を確保
st->dwInitiatorAddrType = 100
mes "dwInitiatorAddrType=" + st->dwInitiatorAddrType