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

SecPkgContext_CipherInfo

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

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

フィールド

フィールドサイズx64x86説明
dwVersionDWORD4+0+0この構造体のバージョン番号を示す。
dwProtocolDWORD4+4+4接続のプロトコルを示す値。
dwCipherSuiteDWORD4+8+8使用される暗号スイートの番号を示す。
dwBaseCipherSuiteDWORD4+12+12基となる暗号スイートの番号を示す。
szCipherSuiteWCHAR128+16+16暗号スイート名のUnicode文字列。
szCipherWCHAR128+144+144対称暗号アルゴリズム名のUnicode文字列。
dwCipherLenDWORD4+272+272暗号鍵の長さをビット数で示す。
dwCipherBlockLenDWORD4+276+276暗号ブロック長をバイト数で示す。
szHashWCHAR128+280+280ハッシュアルゴリズム名のUnicode文字列。
dwHashLenDWORD4+408+408ハッシュ長をビット数で示す。
szExchangeWCHAR128+412+412鍵交換アルゴリズム名のUnicode文字列。
dwMinExchangeLenDWORD4+540+540鍵交換鍵の最小長をビット数で示す。
dwMaxExchangeLenDWORD4+544+544鍵交換鍵の最大長をビット数で示す。
szCertificateWCHAR128+548+548証明書の署名アルゴリズム名等のUnicode文字列。
dwKeyTypeDWORD4+676+676鍵の種別を示す値。

各言語での定義

#include <windows.h>

// 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;
using System;
using System.Runtime.InteropServices;

[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;
}
Imports System.Runtime.InteropServices

<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
import ctypes
from ctypes import wintypes

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),
    ]
#[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,
}
import "golang.org/x/sys/windows"

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_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;
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,
};
type
  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
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;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SecPkgContext_CipherInfo サイズ: 680 バイト(x64)
dim st, 170    ; 4byte整数×170(構造体サイズ 680 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwProtocol : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwCipherSuite : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwBaseCipherSuite : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; szCipherSuite : WCHAR (+16, 128byte)  varptr(st)+16 を基点に操作(128byte:入れ子/配列)
; szCipher : WCHAR (+144, 128byte)  varptr(st)+144 を基点に操作(128byte:入れ子/配列)
; dwCipherLen : DWORD (+272, 4byte)  st.68 = 値  /  値 = st.68   (lpoke/lpeek も可)
; dwCipherBlockLen : DWORD (+276, 4byte)  st.69 = 値  /  値 = st.69   (lpoke/lpeek も可)
; szHash : WCHAR (+280, 128byte)  varptr(st)+280 を基点に操作(128byte:入れ子/配列)
; dwHashLen : DWORD (+408, 4byte)  st.102 = 値  /  値 = st.102   (lpoke/lpeek も可)
; szExchange : WCHAR (+412, 128byte)  varptr(st)+412 を基点に操作(128byte:入れ子/配列)
; dwMinExchangeLen : DWORD (+540, 4byte)  st.135 = 値  /  値 = st.135   (lpoke/lpeek も可)
; dwMaxExchangeLen : DWORD (+544, 4byte)  st.136 = 値  /  値 = st.136   (lpoke/lpeek も可)
; szCertificate : WCHAR (+548, 128byte)  varptr(st)+548 を基点に操作(128byte:入れ子/配列)
; dwKeyType : DWORD (+676, 4byte)  st.169 = 値  /  値 = st.169   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#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

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