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

SecPkgContext_CertInfo

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

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

フィールド

フィールドサイズx64x86説明
dwVersionDWORD4+0+0この構造体のバージョン番号を示す。
cbSubjectNameDWORD4+4+4サブジェクト名のバイト数を示す。
pwszSubjectNameLPWSTR8/4+8+8証明書のサブジェクト名のUnicode文字列へのポインタ。
cbIssuerNameDWORD4+16+12発行者名のバイト数を示す。
pwszIssuerNameLPWSTR8/4+24+16証明書の発行者名のUnicode文字列へのポインタ。
dwKeySizeDWORD4+32+20証明書の公開鍵サイズをビット数で示す。

各言語での定義

#include <windows.h>

// SecPkgContext_CertInfo  (x64 40 / x86 24 バイト)
typedef struct SecPkgContext_CertInfo {
    DWORD dwVersion;
    DWORD cbSubjectName;
    LPWSTR pwszSubjectName;
    DWORD cbIssuerName;
    LPWSTR pwszIssuerName;
    DWORD dwKeySize;
} SecPkgContext_CertInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SecPkgContext_CertInfo
{
    public uint dwVersion;
    public uint cbSubjectName;
    public IntPtr pwszSubjectName;
    public uint cbIssuerName;
    public IntPtr pwszIssuerName;
    public uint dwKeySize;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SecPkgContext_CertInfo
    Public dwVersion As UInteger
    Public cbSubjectName As UInteger
    Public pwszSubjectName As IntPtr
    Public cbIssuerName As UInteger
    Public pwszIssuerName As IntPtr
    Public dwKeySize As UInteger
End Structure
import ctypes
from ctypes import wintypes

class SecPkgContext_CertInfo(ctypes.Structure):
    _fields_ = [
        ("dwVersion", wintypes.DWORD),
        ("cbSubjectName", wintypes.DWORD),
        ("pwszSubjectName", ctypes.c_void_p),
        ("cbIssuerName", wintypes.DWORD),
        ("pwszIssuerName", ctypes.c_void_p),
        ("dwKeySize", wintypes.DWORD),
    ]
#[repr(C)]
pub struct SecPkgContext_CertInfo {
    pub dwVersion: u32,
    pub cbSubjectName: u32,
    pub pwszSubjectName: *mut core::ffi::c_void,
    pub cbIssuerName: u32,
    pub pwszIssuerName: *mut core::ffi::c_void,
    pub dwKeySize: u32,
}
import "golang.org/x/sys/windows"

type SecPkgContext_CertInfo struct {
	dwVersion uint32
	cbSubjectName uint32
	pwszSubjectName uintptr
	cbIssuerName uint32
	pwszIssuerName uintptr
	dwKeySize uint32
}
type
  SecPkgContext_CertInfo = record
    dwVersion: DWORD;
    cbSubjectName: DWORD;
    pwszSubjectName: Pointer;
    cbIssuerName: DWORD;
    pwszIssuerName: Pointer;
    dwKeySize: DWORD;
  end;
const SecPkgContext_CertInfo = extern struct {
    dwVersion: u32,
    cbSubjectName: u32,
    pwszSubjectName: ?*anyopaque,
    cbIssuerName: u32,
    pwszIssuerName: ?*anyopaque,
    dwKeySize: u32,
};
type
  SecPkgContext_CertInfo {.bycopy.} = object
    dwVersion: uint32
    cbSubjectName: uint32
    pwszSubjectName: pointer
    cbIssuerName: uint32
    pwszIssuerName: pointer
    dwKeySize: uint32
struct SecPkgContext_CertInfo
{
    uint dwVersion;
    uint cbSubjectName;
    void* pwszSubjectName;
    uint cbIssuerName;
    void* pwszIssuerName;
    uint dwKeySize;
}

HSP用 定義

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

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

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