ホーム › Networking.WinInet › INTERNET_SECURITY_CONNECTION_INFO
INTERNET_SECURITY_CONNECTION_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwSize | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で示す。 |
| fSecure | BOOL | 4 | +4 | +4 | 接続がセキュア(SSL/TLS)であるかを示す真偽値である。 |
| connectionInfo | SecPkgContext_ConnectionInfo | 28 | +8 | +8 | 接続のプロトコルバージョン等を示す接続情報である。 |
| cipherInfo | SecPkgContext_CipherInfo | 680 | +36 | +36 | 使用される暗号アルゴリズムの詳細情報である。 |
各言語での定義
#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;
// SecPkgContext_CipherInfo (x64 680 / x86 680 バイト)
typedef struct SecPkgContext_CipherInfo {
DWORD dwVersion;
DWORD dwProtocol;
DWORD dwCipherSuite;
DWORD dwBaseCipherSuite;
WCHAR szCipherSuite[64];
WCHAR szCipher[64];
DWORD dwCipherLen;
DWORD dwCipherBlockLen;
WCHAR szHash[64];
DWORD dwHashLen;
WCHAR szExchange[64];
DWORD dwMinExchangeLen;
DWORD dwMaxExchangeLen;
WCHAR szCertificate[64];
DWORD dwKeyType;
} SecPkgContext_CipherInfo;
// INTERNET_SECURITY_CONNECTION_INFO (x64 716 / x86 716 バイト)
typedef struct INTERNET_SECURITY_CONNECTION_INFO {
DWORD dwSize;
BOOL fSecure;
SecPkgContext_ConnectionInfo connectionInfo;
SecPkgContext_CipherInfo cipherInfo;
} INTERNET_SECURITY_CONNECTION_INFO;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;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SecPkgContext_CipherInfo
{
public uint dwVersion;
public uint dwProtocol;
public uint dwCipherSuite;
public uint dwBaseCipherSuite;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szCipherSuite;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szCipher;
public uint dwCipherLen;
public uint dwCipherBlockLen;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szHash;
public uint dwHashLen;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szExchange;
public uint dwMinExchangeLen;
public uint dwMaxExchangeLen;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szCertificate;
public uint dwKeyType;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct INTERNET_SECURITY_CONNECTION_INFO
{
public uint dwSize;
[MarshalAs(UnmanagedType.Bool)] public bool fSecure;
public SecPkgContext_ConnectionInfo connectionInfo;
public SecPkgContext_CipherInfo cipherInfo;
}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
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SecPkgContext_CipherInfo
Public dwVersion As UInteger
Public dwProtocol As UInteger
Public dwCipherSuite As UInteger
Public dwBaseCipherSuite As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szCipherSuite As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szCipher As String
Public dwCipherLen As UInteger
Public dwCipherBlockLen As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szHash As String
Public dwHashLen As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szExchange As String
Public dwMinExchangeLen As UInteger
Public dwMaxExchangeLen As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szCertificate As String
Public dwKeyType As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure INTERNET_SECURITY_CONNECTION_INFO
Public dwSize As UInteger
<MarshalAs(UnmanagedType.Bool)> Public fSecure As Boolean
Public connectionInfo As SecPkgContext_ConnectionInfo
Public cipherInfo As SecPkgContext_CipherInfo
End Structureimport 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),
]
class SecPkgContext_CipherInfo(ctypes.Structure):
_fields_ = [
("dwVersion", wintypes.DWORD),
("dwProtocol", wintypes.DWORD),
("dwCipherSuite", wintypes.DWORD),
("dwBaseCipherSuite", wintypes.DWORD),
("szCipherSuite", ctypes.c_wchar * 64),
("szCipher", ctypes.c_wchar * 64),
("dwCipherLen", wintypes.DWORD),
("dwCipherBlockLen", wintypes.DWORD),
("szHash", ctypes.c_wchar * 64),
("dwHashLen", wintypes.DWORD),
("szExchange", ctypes.c_wchar * 64),
("dwMinExchangeLen", wintypes.DWORD),
("dwMaxExchangeLen", wintypes.DWORD),
("szCertificate", ctypes.c_wchar * 64),
("dwKeyType", wintypes.DWORD),
]
class INTERNET_SECURITY_CONNECTION_INFO(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("fSecure", wintypes.BOOL),
("connectionInfo", SecPkgContext_ConnectionInfo),
("cipherInfo", SecPkgContext_CipherInfo),
]#[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,
}
#[repr(C)]
pub struct SecPkgContext_CipherInfo {
pub dwVersion: u32,
pub dwProtocol: u32,
pub dwCipherSuite: u32,
pub dwBaseCipherSuite: u32,
pub szCipherSuite: [u16; 64],
pub szCipher: [u16; 64],
pub dwCipherLen: u32,
pub dwCipherBlockLen: u32,
pub szHash: [u16; 64],
pub dwHashLen: u32,
pub szExchange: [u16; 64],
pub dwMinExchangeLen: u32,
pub dwMaxExchangeLen: u32,
pub szCertificate: [u16; 64],
pub dwKeyType: u32,
}
#[repr(C)]
pub struct INTERNET_SECURITY_CONNECTION_INFO {
pub dwSize: u32,
pub fSecure: i32,
pub connectionInfo: SecPkgContext_ConnectionInfo,
pub cipherInfo: SecPkgContext_CipherInfo,
}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_CipherInfo struct {
dwVersion uint32
dwProtocol uint32
dwCipherSuite uint32
dwBaseCipherSuite uint32
szCipherSuite [64]uint16
szCipher [64]uint16
dwCipherLen uint32
dwCipherBlockLen uint32
szHash [64]uint16
dwHashLen uint32
szExchange [64]uint16
dwMinExchangeLen uint32
dwMaxExchangeLen uint32
szCertificate [64]uint16
dwKeyType uint32
}
type INTERNET_SECURITY_CONNECTION_INFO struct {
dwSize uint32
fSecure int32
connectionInfo SecPkgContext_ConnectionInfo
cipherInfo SecPkgContext_CipherInfo
}type
SecPkgContext_ConnectionInfo = record
dwProtocol: DWORD;
aiCipher: DWORD;
dwCipherStrength: DWORD;
aiHash: DWORD;
dwHashStrength: DWORD;
aiExch: DWORD;
dwExchStrength: DWORD;
end;
SecPkgContext_CipherInfo = record
dwVersion: DWORD;
dwProtocol: DWORD;
dwCipherSuite: DWORD;
dwBaseCipherSuite: DWORD;
szCipherSuite: array[0..63] of WideChar;
szCipher: array[0..63] of WideChar;
dwCipherLen: DWORD;
dwCipherBlockLen: DWORD;
szHash: array[0..63] of WideChar;
dwHashLen: DWORD;
szExchange: array[0..63] of WideChar;
dwMinExchangeLen: DWORD;
dwMaxExchangeLen: DWORD;
szCertificate: array[0..63] of WideChar;
dwKeyType: DWORD;
end;
INTERNET_SECURITY_CONNECTION_INFO = record
dwSize: DWORD;
fSecure: BOOL;
connectionInfo: SecPkgContext_ConnectionInfo;
cipherInfo: SecPkgContext_CipherInfo;
end;const SecPkgContext_ConnectionInfo = extern struct {
dwProtocol: u32,
aiCipher: u32,
dwCipherStrength: u32,
aiHash: u32,
dwHashStrength: u32,
aiExch: u32,
dwExchStrength: u32,
};
const SecPkgContext_CipherInfo = extern struct {
dwVersion: u32,
dwProtocol: u32,
dwCipherSuite: u32,
dwBaseCipherSuite: u32,
szCipherSuite: [64]u16,
szCipher: [64]u16,
dwCipherLen: u32,
dwCipherBlockLen: u32,
szHash: [64]u16,
dwHashLen: u32,
szExchange: [64]u16,
dwMinExchangeLen: u32,
dwMaxExchangeLen: u32,
szCertificate: [64]u16,
dwKeyType: u32,
};
const INTERNET_SECURITY_CONNECTION_INFO = extern struct {
dwSize: u32,
fSecure: i32,
connectionInfo: SecPkgContext_ConnectionInfo,
cipherInfo: SecPkgContext_CipherInfo,
};type
SecPkgContext_ConnectionInfo {.bycopy.} = object
dwProtocol: uint32
aiCipher: uint32
dwCipherStrength: uint32
aiHash: uint32
dwHashStrength: uint32
aiExch: uint32
dwExchStrength: uint32
SecPkgContext_CipherInfo {.bycopy.} = object
dwVersion: uint32
dwProtocol: uint32
dwCipherSuite: uint32
dwBaseCipherSuite: uint32
szCipherSuite: array[64, uint16]
szCipher: array[64, uint16]
dwCipherLen: uint32
dwCipherBlockLen: uint32
szHash: array[64, uint16]
dwHashLen: uint32
szExchange: array[64, uint16]
dwMinExchangeLen: uint32
dwMaxExchangeLen: uint32
szCertificate: array[64, uint16]
dwKeyType: uint32
INTERNET_SECURITY_CONNECTION_INFO {.bycopy.} = object
dwSize: uint32
fSecure: int32
connectionInfo: SecPkgContext_ConnectionInfo
cipherInfo: SecPkgContext_CipherInfostruct SecPkgContext_ConnectionInfo
{
uint dwProtocol;
uint aiCipher;
uint dwCipherStrength;
uint aiHash;
uint dwHashStrength;
uint aiExch;
uint dwExchStrength;
}
struct SecPkgContext_CipherInfo
{
uint dwVersion;
uint dwProtocol;
uint dwCipherSuite;
uint dwBaseCipherSuite;
wchar[64] szCipherSuite;
wchar[64] szCipher;
uint dwCipherLen;
uint dwCipherBlockLen;
wchar[64] szHash;
uint dwHashLen;
wchar[64] szExchange;
uint dwMinExchangeLen;
uint dwMaxExchangeLen;
wchar[64] szCertificate;
uint dwKeyType;
}
struct INTERNET_SECURITY_CONNECTION_INFO
{
uint dwSize;
int fSecure;
SecPkgContext_ConnectionInfo connectionInfo;
SecPkgContext_CipherInfo cipherInfo;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; INTERNET_SECURITY_CONNECTION_INFO サイズ: 716 バイト(x64)
dim st, 179 ; 4byte整数×179(構造体サイズ 716 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; fSecure : BOOL (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; connectionInfo : SecPkgContext_ConnectionInfo (+8, 28byte) varptr(st)+8 を基点に操作(28byte:入れ子/配列)
; cipherInfo : SecPkgContext_CipherInfo (+36, 680byte) varptr(st)+36 を基点に操作(680byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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
#defstruct global SecPkgContext_CipherInfo
#field int dwVersion
#field int dwProtocol
#field int dwCipherSuite
#field int dwBaseCipherSuite
#field wchar szCipherSuite 64
#field wchar szCipher 64
#field int dwCipherLen
#field int dwCipherBlockLen
#field wchar szHash 64
#field int dwHashLen
#field wchar szExchange 64
#field int dwMinExchangeLen
#field int dwMaxExchangeLen
#field wchar szCertificate 64
#field int dwKeyType
#endstruct
#defstruct global INTERNET_SECURITY_CONNECTION_INFO
#field int dwSize
#field bool fSecure
#field SecPkgContext_ConnectionInfo connectionInfo
#field SecPkgContext_CipherInfo cipherInfo
#endstruct
stdim st, INTERNET_SECURITY_CONNECTION_INFO ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize