ホーム › Networking.WinInet › INTERNET_SECURITY_INFO
INTERNET_SECURITY_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwSize | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で示す。 |
| pCertificate | CERT_CONTEXT* | 8/4 | +8 | +4 | サーバ証明書を表すCERT_CONTEXTへのポインタである。 |
| pcCertChain | CERT_CHAIN_CONTEXT* | 8/4 | +16 | +8 | 検証済みの証明書チェーンを表すCERT_CHAIN_CONTEXTへのポインタである。 |
| connectionInfo | SecPkgContext_ConnectionInfo | 28 | +24 | +12 | SSL/TLS接続のプロトコルや暗号方式を示す接続情報である。 |
| cipherInfo | SecPkgContext_CipherInfo | 680 | +52 | +40 | 使用される暗号アルゴリズムの詳細を示す情報である。 |
| pcUnverifiedCertChain | CERT_CHAIN_CONTEXT* | 8/4 | +736 | +720 | 未検証の証明書チェーンへのポインタである。NULL可。 |
| channelBindingToken | SecPkgContext_Bindings | 16/8 | +744 | +724 | チャネルバインディング用のトークン情報である。 |
各言語での定義
#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;
// SecPkgContext_Bindings (x64 16 / x86 8 バイト)
typedef struct SecPkgContext_Bindings {
DWORD BindingsLength;
SEC_CHANNEL_BINDINGS* Bindings;
} SecPkgContext_Bindings;
// INTERNET_SECURITY_INFO (x64 760 / x86 732 バイト)
typedef struct INTERNET_SECURITY_INFO {
DWORD dwSize;
CERT_CONTEXT* pCertificate;
CERT_CHAIN_CONTEXT* pcCertChain;
SecPkgContext_ConnectionInfo connectionInfo;
SecPkgContext_CipherInfo cipherInfo;
CERT_CHAIN_CONTEXT* pcUnverifiedCertChain;
SecPkgContext_Bindings channelBindingToken;
} INTERNET_SECURITY_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 SecPkgContext_Bindings
{
public uint BindingsLength;
public IntPtr Bindings;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct INTERNET_SECURITY_INFO
{
public uint dwSize;
public IntPtr pCertificate;
public IntPtr pcCertChain;
public SecPkgContext_ConnectionInfo connectionInfo;
public SecPkgContext_CipherInfo cipherInfo;
public IntPtr pcUnverifiedCertChain;
public SecPkgContext_Bindings channelBindingToken;
}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 SecPkgContext_Bindings
Public BindingsLength As UInteger
Public Bindings As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure INTERNET_SECURITY_INFO
Public dwSize As UInteger
Public pCertificate As IntPtr
Public pcCertChain As IntPtr
Public connectionInfo As SecPkgContext_ConnectionInfo
Public cipherInfo As SecPkgContext_CipherInfo
Public pcUnverifiedCertChain As IntPtr
Public channelBindingToken As SecPkgContext_Bindings
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 SecPkgContext_Bindings(ctypes.Structure):
_fields_ = [
("BindingsLength", wintypes.DWORD),
("Bindings", ctypes.c_void_p),
]
class INTERNET_SECURITY_INFO(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("pCertificate", ctypes.c_void_p),
("pcCertChain", ctypes.c_void_p),
("connectionInfo", SecPkgContext_ConnectionInfo),
("cipherInfo", SecPkgContext_CipherInfo),
("pcUnverifiedCertChain", ctypes.c_void_p),
("channelBindingToken", SecPkgContext_Bindings),
]#[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 SecPkgContext_Bindings {
pub BindingsLength: u32,
pub Bindings: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct INTERNET_SECURITY_INFO {
pub dwSize: u32,
pub pCertificate: *mut core::ffi::c_void,
pub pcCertChain: *mut core::ffi::c_void,
pub connectionInfo: SecPkgContext_ConnectionInfo,
pub cipherInfo: SecPkgContext_CipherInfo,
pub pcUnverifiedCertChain: *mut core::ffi::c_void,
pub channelBindingToken: SecPkgContext_Bindings,
}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 SecPkgContext_Bindings struct {
BindingsLength uint32
Bindings uintptr
}
type INTERNET_SECURITY_INFO struct {
dwSize uint32
pCertificate uintptr
pcCertChain uintptr
connectionInfo SecPkgContext_ConnectionInfo
cipherInfo SecPkgContext_CipherInfo
pcUnverifiedCertChain uintptr
channelBindingToken SecPkgContext_Bindings
}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;
SecPkgContext_Bindings = record
BindingsLength: DWORD;
Bindings: Pointer;
end;
INTERNET_SECURITY_INFO = record
dwSize: DWORD;
pCertificate: Pointer;
pcCertChain: Pointer;
connectionInfo: SecPkgContext_ConnectionInfo;
cipherInfo: SecPkgContext_CipherInfo;
pcUnverifiedCertChain: Pointer;
channelBindingToken: SecPkgContext_Bindings;
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 SecPkgContext_Bindings = extern struct {
BindingsLength: u32,
Bindings: ?*anyopaque,
};
const INTERNET_SECURITY_INFO = extern struct {
dwSize: u32,
pCertificate: ?*anyopaque,
pcCertChain: ?*anyopaque,
connectionInfo: SecPkgContext_ConnectionInfo,
cipherInfo: SecPkgContext_CipherInfo,
pcUnverifiedCertChain: ?*anyopaque,
channelBindingToken: SecPkgContext_Bindings,
};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
SecPkgContext_Bindings {.bycopy.} = object
BindingsLength: uint32
Bindings: pointer
INTERNET_SECURITY_INFO {.bycopy.} = object
dwSize: uint32
pCertificate: pointer
pcCertChain: pointer
connectionInfo: SecPkgContext_ConnectionInfo
cipherInfo: SecPkgContext_CipherInfo
pcUnverifiedCertChain: pointer
channelBindingToken: SecPkgContext_Bindingsstruct 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 SecPkgContext_Bindings
{
uint BindingsLength;
void* Bindings;
}
struct INTERNET_SECURITY_INFO
{
uint dwSize;
void* pCertificate;
void* pcCertChain;
SecPkgContext_ConnectionInfo connectionInfo;
SecPkgContext_CipherInfo cipherInfo;
void* pcUnverifiedCertChain;
SecPkgContext_Bindings channelBindingToken;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; INTERNET_SECURITY_INFO サイズ: 732 バイト(x86)
dim st, 183 ; 4byte整数×183(構造体サイズ 732 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pCertificate : CERT_CONTEXT* (+4, 4byte) varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; pcCertChain : CERT_CHAIN_CONTEXT* (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; connectionInfo : SecPkgContext_ConnectionInfo (+12, 28byte) varptr(st)+12 を基点に操作(28byte:入れ子/配列)
; cipherInfo : SecPkgContext_CipherInfo (+40, 680byte) varptr(st)+40 を基点に操作(680byte:入れ子/配列)
; pcUnverifiedCertChain : CERT_CHAIN_CONTEXT* (+720, 4byte) varptr(st)+720 を基点に操作(4byte:入れ子/配列)
; channelBindingToken : SecPkgContext_Bindings (+724, 8byte) varptr(st)+724 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; INTERNET_SECURITY_INFO サイズ: 760 バイト(x64)
dim st, 190 ; 4byte整数×190(構造体サイズ 760 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pCertificate : CERT_CONTEXT* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; pcCertChain : CERT_CHAIN_CONTEXT* (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; connectionInfo : SecPkgContext_ConnectionInfo (+24, 28byte) varptr(st)+24 を基点に操作(28byte:入れ子/配列)
; cipherInfo : SecPkgContext_CipherInfo (+52, 680byte) varptr(st)+52 を基点に操作(680byte:入れ子/配列)
; pcUnverifiedCertChain : CERT_CHAIN_CONTEXT* (+736, 8byte) varptr(st)+736 を基点に操作(8byte:入れ子/配列)
; channelBindingToken : SecPkgContext_Bindings (+744, 16byte) varptr(st)+744 を基点に操作(16byte:入れ子/配列)
; ※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 SecPkgContext_Bindings
#field int BindingsLength
#field intptr Bindings
#endstruct
#defstruct global INTERNET_SECURITY_INFO
#field int dwSize
#field intptr pCertificate
#field intptr pcCertChain
#field SecPkgContext_ConnectionInfo connectionInfo
#field SecPkgContext_CipherInfo cipherInfo
#field intptr pcUnverifiedCertChain
#field SecPkgContext_Bindings channelBindingToken
#endstruct
stdim st, INTERNET_SECURITY_INFO ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize