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

SecPkgContext_ConnectionInfo

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

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

フィールド

フィールドサイズx64x86説明
dwProtocolDWORD4+0+0

この接続の確立に使用されたプロトコルです。次の表に、このメンバーに指定できる定数を示します。

意味
SP_PROT_SSL2_CLIENT
8 (0x8)
Secure Sockets Layer 2.0 のクライアント側です。SP_PROT_TLS1_CLIENT に置き換えられました。
SP_PROT_SSL2_SERVER
4 (0x4)
Secure Sockets Layer 2.0 のサーバー側です。SP_PROT_TLS1_SERVER に置き換えられました。
SP_PROT_SSL3_CLIENT
32 (0x20)
Secure Sockets Layer 3.0 のクライアント側です。
SP_PROT_SSL3_SERVER
16 (0x10)
Secure Sockets Layer 3.0 のサーバー側です。
SP_PROT_TLS1_0_CLIENT
128 (0x80)
Transport Layer Security 1.0 のクライアント側です。
SP_PROT_TLS1_0_SERVER
64 (0x40)
Transport Layer Security 1.0 のサーバー側です。
SP_PROT_TLS1_1_CLIENT
512 (0x200)
Transport Layer Security 1.1 のクライアント側です。
SP_PROT_TLS1_1_SERVER
256 (0x100)
Transport Layer Security 1.1 のサーバー側です。
SP_PROT_TLS1_2_CLIENT
2048 (0x800)
Transport Layer Security 1.2 のクライアント側です。
SP_PROT_TLS1_2_SERVER
1024 (0x400)
Transport Layer Security 1.2 のサーバー側です。
SP_PROT_TLS1_3_CLIENT
8192 (0x2000)
Transport Layer Security 1.3 のクライアント側です。
SP_PROT_TLS1_3_SERVER
4096 (0x1000)
Transport Layer Security 1.3 のサーバー側です。
SP_PROT_DTLS1_0_CLIENT
131072 (0x00020000)
Datagram Transport Layer Security 1.0 のクライアント側です。
SP_PROT_DTLS1_0_SERVER
65536 (0x00010000)
Datagram Transport Layer Security 1.0 のサーバー側です。
SP_PROT_DTLS1_2_CLIENT
524288 (0x00080000)
Datagram Transport Layer Security 1.2 のクライアント側です。
SP_PROT_DTLS1_2_SERVER
262144 (0x00040000)
Datagram Transport Layer Security 1.2 のサーバー側です。
aiCipherALG_ID4+4+4

この接続で使用されるバルク暗号化の暗号アルゴリズム識別子 (ALG_ID) です。次の表に、このメンバーに指定できる定数を示します。

意味
CALG_3DES
3DES ブロック暗号化アルゴリズム
CALG_AES_128
AES 128 ビット暗号化アルゴリズム
CALG_AES_256
AES 256 ビット暗号化アルゴリズム
CALG_DES
DES 暗号化アルゴリズム
CALG_RC2
RC2 ブロック暗号化アルゴリズム
CALG_RC4
RC4 ストリーム暗号化アルゴリズム
0 (Zero)
暗号化なし
dwCipherStrengthDWORD4+8+8バルク暗号化の暗号強度 (ビット単位) です。0、40、56、128、168、256 のいずれかの値になります。
aiHashALG_ID4+12+12

メッセージ認証コード (MAC) の生成に使用されるハッシュを示す ALG_ID です。次の表に、このメンバーに指定できる定数を示します。

意味
CALG_MD5
MD5 ハッシュ アルゴリズムです。
CALG_SHA
SHA ハッシュ アルゴリズムです。
dwHashStrengthDWORD4+16+16ハッシュの強度 (ビット単位) です。128 または 160 です。
aiExchALG_ID4+20+20

共有マスター シークレットの生成に使用されるキー交換アルゴリズムを示す ALG_ID です。次の表に、このメンバーに指定できる定数を示します。

意味
ALG_TYPE_ANY
任意のキー交換アルゴリズムです。
CALG_RSA_KEYX
RSA キー交換です。
CALG_DH_EPHEM
Diffie-Hellman キー交換です。
dwExchStrengthDWORD4+24+24キーの長さ (ビット単位) です。RSA キー交換の場合、このメンバーには通常 512、768、1024、2048 のいずれかの値が格納されます。Diffie-Hellman キー交換の場合、このメンバーには通常 224、256、384、512 のいずれかの値が格納されます。

公式ドキュメント

SecPkgContext_ConnectionInfo 構造体には、プロトコルと暗号に関する情報が格納されます。この構造体は InitializeSecurityContext (Schannel) 関数で使用されます。

この属性は Schannel セキュリティ サポート プロバイダー (SSP) でのみサポートされます。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// SecPkgContext_ConnectionInfo  (x64 28 / x86 28 バイト)
typedef struct SecPkgContext_ConnectionInfo {
    DWORD dwProtocol;
    ALG_ID aiCipher;
    DWORD dwCipherStrength;
    ALG_ID aiHash;
    DWORD dwHashStrength;
    ALG_ID aiExch;
    DWORD dwExchStrength;
} SecPkgContext_ConnectionInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SecPkgContext_ConnectionInfo
{
    public uint dwProtocol;
    public uint aiCipher;
    public uint dwCipherStrength;
    public uint aiHash;
    public uint dwHashStrength;
    public uint aiExch;
    public uint dwExchStrength;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SecPkgContext_ConnectionInfo
    Public dwProtocol As UInteger
    Public aiCipher As UInteger
    Public dwCipherStrength As UInteger
    Public aiHash As UInteger
    Public dwHashStrength As UInteger
    Public aiExch As UInteger
    Public dwExchStrength As UInteger
End Structure
import ctypes
from ctypes import wintypes

class SecPkgContext_ConnectionInfo(ctypes.Structure):
    _fields_ = [
        ("dwProtocol", wintypes.DWORD),
        ("aiCipher", wintypes.DWORD),
        ("dwCipherStrength", wintypes.DWORD),
        ("aiHash", wintypes.DWORD),
        ("dwHashStrength", wintypes.DWORD),
        ("aiExch", wintypes.DWORD),
        ("dwExchStrength", wintypes.DWORD),
    ]
#[repr(C)]
pub struct SecPkgContext_ConnectionInfo {
    pub dwProtocol: u32,
    pub aiCipher: u32,
    pub dwCipherStrength: u32,
    pub aiHash: u32,
    pub dwHashStrength: u32,
    pub aiExch: u32,
    pub dwExchStrength: u32,
}
import "golang.org/x/sys/windows"

type SecPkgContext_ConnectionInfo struct {
	dwProtocol uint32
	aiCipher uint32
	dwCipherStrength uint32
	aiHash uint32
	dwHashStrength uint32
	aiExch uint32
	dwExchStrength uint32
}
type
  SecPkgContext_ConnectionInfo = record
    dwProtocol: DWORD;
    aiCipher: DWORD;
    dwCipherStrength: DWORD;
    aiHash: DWORD;
    dwHashStrength: DWORD;
    aiExch: DWORD;
    dwExchStrength: DWORD;
  end;
const SecPkgContext_ConnectionInfo = extern struct {
    dwProtocol: u32,
    aiCipher: u32,
    dwCipherStrength: u32,
    aiHash: u32,
    dwHashStrength: u32,
    aiExch: u32,
    dwExchStrength: u32,
};
type
  SecPkgContext_ConnectionInfo {.bycopy.} = object
    dwProtocol: uint32
    aiCipher: uint32
    dwCipherStrength: uint32
    aiHash: uint32
    dwHashStrength: uint32
    aiExch: uint32
    dwExchStrength: uint32
struct SecPkgContext_ConnectionInfo
{
    uint dwProtocol;
    uint aiCipher;
    uint dwCipherStrength;
    uint aiHash;
    uint dwHashStrength;
    uint aiExch;
    uint dwExchStrength;
}

HSP用 定義

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

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

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