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

SCHANNEL_CRED

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

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

フィールド

フィールドサイズx64x86説明
dwVersionDWORD4+0+0この構造体のバージョン。SCHANNEL_CRED_VERSIONを設定する。
cCredsDWORD4+4+4paCred配列内の証明書の個数を示す。
paCredCERT_CONTEXT**8/4+8+8使用する証明書コンテキストの配列へのポインタ。
hRootStoreHCERTSTORE8/4+16+12ルート証明書ストアのハンドル。サーバーのみ使用。NULL可。
cMappersDWORD4+24+16aphMappers配列内のマッパーの個数を示す。
aphMappers_HMAPPER**8/4+32+20資格情報マッパーの配列へのポインタ。通常未使用。
cSupportedAlgsDWORD4+40+24palgSupportedAlgs配列のアルゴリズム個数を示す。
palgSupportedAlgsALG_ID*8/4+48+28サポートするアルゴリズムID(ALG_ID)配列へのポインタ。
grbitEnabledProtocolsDWORD4+56+32有効化するプロトコルを示すビットマスク。0で既定。
dwMinimumCipherStrengthDWORD4+60+36許容する最小暗号強度をビット数で示す。
dwMaximumCipherStrengthDWORD4+64+40許容する最大暗号強度をビット数で示す。
dwSessionLifespanDWORD4+68+44セッションのキャッシュ有効期間をミリ秒で示す。0で既定。
dwFlagsSCHANNEL_CRED_FLAGS4+72+48Schannel資格情報の動作を制御するフラグ群。
dwCredFormatDWORD4+76+52資格情報の形式を示す値。

各言語での定義

#include <windows.h>

// SCHANNEL_CRED  (x64 80 / x86 56 バイト)
typedef struct SCHANNEL_CRED {
    DWORD dwVersion;
    DWORD cCreds;
    CERT_CONTEXT** paCred;
    HCERTSTORE hRootStore;
    DWORD cMappers;
    _HMAPPER** aphMappers;
    DWORD cSupportedAlgs;
    ALG_ID* palgSupportedAlgs;
    DWORD grbitEnabledProtocols;
    DWORD dwMinimumCipherStrength;
    DWORD dwMaximumCipherStrength;
    DWORD dwSessionLifespan;
    SCHANNEL_CRED_FLAGS dwFlags;
    DWORD dwCredFormat;
} SCHANNEL_CRED;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SCHANNEL_CRED
{
    public uint dwVersion;
    public uint cCreds;
    public IntPtr paCred;
    public IntPtr hRootStore;
    public uint cMappers;
    public IntPtr aphMappers;
    public uint cSupportedAlgs;
    public IntPtr palgSupportedAlgs;
    public uint grbitEnabledProtocols;
    public uint dwMinimumCipherStrength;
    public uint dwMaximumCipherStrength;
    public uint dwSessionLifespan;
    public uint dwFlags;
    public uint dwCredFormat;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SCHANNEL_CRED
    Public dwVersion As UInteger
    Public cCreds As UInteger
    Public paCred As IntPtr
    Public hRootStore As IntPtr
    Public cMappers As UInteger
    Public aphMappers As IntPtr
    Public cSupportedAlgs As UInteger
    Public palgSupportedAlgs As IntPtr
    Public grbitEnabledProtocols As UInteger
    Public dwMinimumCipherStrength As UInteger
    Public dwMaximumCipherStrength As UInteger
    Public dwSessionLifespan As UInteger
    Public dwFlags As UInteger
    Public dwCredFormat As UInteger
End Structure
import ctypes
from ctypes import wintypes

class SCHANNEL_CRED(ctypes.Structure):
    _fields_ = [
        ("dwVersion", wintypes.DWORD),
        ("cCreds", wintypes.DWORD),
        ("paCred", ctypes.c_void_p),
        ("hRootStore", ctypes.c_void_p),
        ("cMappers", wintypes.DWORD),
        ("aphMappers", ctypes.c_void_p),
        ("cSupportedAlgs", wintypes.DWORD),
        ("palgSupportedAlgs", ctypes.c_void_p),
        ("grbitEnabledProtocols", wintypes.DWORD),
        ("dwMinimumCipherStrength", wintypes.DWORD),
        ("dwMaximumCipherStrength", wintypes.DWORD),
        ("dwSessionLifespan", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("dwCredFormat", wintypes.DWORD),
    ]
#[repr(C)]
pub struct SCHANNEL_CRED {
    pub dwVersion: u32,
    pub cCreds: u32,
    pub paCred: *mut core::ffi::c_void,
    pub hRootStore: *mut core::ffi::c_void,
    pub cMappers: u32,
    pub aphMappers: *mut core::ffi::c_void,
    pub cSupportedAlgs: u32,
    pub palgSupportedAlgs: *mut core::ffi::c_void,
    pub grbitEnabledProtocols: u32,
    pub dwMinimumCipherStrength: u32,
    pub dwMaximumCipherStrength: u32,
    pub dwSessionLifespan: u32,
    pub dwFlags: u32,
    pub dwCredFormat: u32,
}
import "golang.org/x/sys/windows"

type SCHANNEL_CRED struct {
	dwVersion uint32
	cCreds uint32
	paCred uintptr
	hRootStore uintptr
	cMappers uint32
	aphMappers uintptr
	cSupportedAlgs uint32
	palgSupportedAlgs uintptr
	grbitEnabledProtocols uint32
	dwMinimumCipherStrength uint32
	dwMaximumCipherStrength uint32
	dwSessionLifespan uint32
	dwFlags uint32
	dwCredFormat uint32
}
type
  SCHANNEL_CRED = record
    dwVersion: DWORD;
    cCreds: DWORD;
    paCred: Pointer;
    hRootStore: Pointer;
    cMappers: DWORD;
    aphMappers: Pointer;
    cSupportedAlgs: DWORD;
    palgSupportedAlgs: Pointer;
    grbitEnabledProtocols: DWORD;
    dwMinimumCipherStrength: DWORD;
    dwMaximumCipherStrength: DWORD;
    dwSessionLifespan: DWORD;
    dwFlags: DWORD;
    dwCredFormat: DWORD;
  end;
const SCHANNEL_CRED = extern struct {
    dwVersion: u32,
    cCreds: u32,
    paCred: ?*anyopaque,
    hRootStore: ?*anyopaque,
    cMappers: u32,
    aphMappers: ?*anyopaque,
    cSupportedAlgs: u32,
    palgSupportedAlgs: ?*anyopaque,
    grbitEnabledProtocols: u32,
    dwMinimumCipherStrength: u32,
    dwMaximumCipherStrength: u32,
    dwSessionLifespan: u32,
    dwFlags: u32,
    dwCredFormat: u32,
};
type
  SCHANNEL_CRED {.bycopy.} = object
    dwVersion: uint32
    cCreds: uint32
    paCred: pointer
    hRootStore: pointer
    cMappers: uint32
    aphMappers: pointer
    cSupportedAlgs: uint32
    palgSupportedAlgs: pointer
    grbitEnabledProtocols: uint32
    dwMinimumCipherStrength: uint32
    dwMaximumCipherStrength: uint32
    dwSessionLifespan: uint32
    dwFlags: uint32
    dwCredFormat: uint32
struct SCHANNEL_CRED
{
    uint dwVersion;
    uint cCreds;
    void* paCred;
    void* hRootStore;
    uint cMappers;
    void* aphMappers;
    uint cSupportedAlgs;
    void* palgSupportedAlgs;
    uint grbitEnabledProtocols;
    uint dwMinimumCipherStrength;
    uint dwMaximumCipherStrength;
    uint dwSessionLifespan;
    uint dwFlags;
    uint dwCredFormat;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SCHANNEL_CRED サイズ: 56 バイト(x86)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; cCreds : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; paCred : CERT_CONTEXT** (+8, 4byte)  varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; hRootStore : HCERTSTORE (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; cMappers : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; aphMappers : _HMAPPER** (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; cSupportedAlgs : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; palgSupportedAlgs : ALG_ID* (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; grbitEnabledProtocols : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwMinimumCipherStrength : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dwMaximumCipherStrength : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; dwSessionLifespan : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; dwFlags : SCHANNEL_CRED_FLAGS (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dwCredFormat : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SCHANNEL_CRED サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; cCreds : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; paCred : CERT_CONTEXT** (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; hRootStore : HCERTSTORE (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; cMappers : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; aphMappers : _HMAPPER** (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; cSupportedAlgs : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; palgSupportedAlgs : ALG_ID* (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; grbitEnabledProtocols : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; dwMinimumCipherStrength : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; dwMaximumCipherStrength : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; dwSessionLifespan : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; dwFlags : SCHANNEL_CRED_FLAGS (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; dwCredFormat : DWORD (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SCHANNEL_CRED
    #field int dwVersion
    #field int cCreds
    #field intptr paCred
    #field intptr hRootStore
    #field int cMappers
    #field intptr aphMappers
    #field int cSupportedAlgs
    #field intptr palgSupportedAlgs
    #field int grbitEnabledProtocols
    #field int dwMinimumCipherStrength
    #field int dwMaximumCipherStrength
    #field int dwSessionLifespan
    #field int dwFlags
    #field int dwCredFormat
#endstruct

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