ホーム › Security.ExtensibleAuthenticationProtocol › EapCredential
EapCredential
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| credType | EapCredentialType | 4 | +0 | +0 | 資格情報の種別を示す列挙値。 |
| credData | EapCredentialTypeData | 32/24 | +8 | +4 | 種別に応じた資格情報データを保持する共用体。 |
各言語での定義
#include <windows.h>
// EapUsernamePasswordCredential (x64 16 / x86 8 バイト)
typedef struct EapUsernamePasswordCredential {
LPWSTR username;
LPWSTR password;
} EapUsernamePasswordCredential;
// EapCertificateCredential (x64 32 / x86 24 バイト)
typedef struct EapCertificateCredential {
BYTE certHash[20];
LPWSTR password;
} EapCertificateCredential;
// EapSimCredential (x64 8 / x86 4 バイト)
typedef struct EapSimCredential {
LPWSTR iccID;
} EapSimCredential;
// EapCredentialTypeData (x64 32 / x86 24 バイト)
typedef struct EapCredentialTypeData {
EapUsernamePasswordCredential username_password;
EapCertificateCredential certificate;
EapSimCredential sim;
} EapCredentialTypeData;
// EapCredential (x64 40 / x86 28 バイト)
typedef struct EapCredential {
EapCredentialType credType;
EapCredentialTypeData credData;
} EapCredential;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EapUsernamePasswordCredential
{
public IntPtr username;
public IntPtr password;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EapCertificateCredential
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] certHash;
public IntPtr password;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EapSimCredential
{
public IntPtr iccID;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EapCredentialTypeData
{
public EapUsernamePasswordCredential username_password;
public EapCertificateCredential certificate;
public EapSimCredential sim;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EapCredential
{
public int credType;
public EapCredentialTypeData credData;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EapUsernamePasswordCredential
Public username As IntPtr
Public password As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EapCertificateCredential
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=20)> Public certHash() As Byte
Public password As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EapSimCredential
Public iccID As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EapCredentialTypeData
Public username_password As EapUsernamePasswordCredential
Public certificate As EapCertificateCredential
Public sim As EapSimCredential
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EapCredential
Public credType As Integer
Public credData As EapCredentialTypeData
End Structureimport ctypes
from ctypes import wintypes
class EapUsernamePasswordCredential(ctypes.Structure):
_fields_ = [
("username", ctypes.c_void_p),
("password", ctypes.c_void_p),
]
class EapCertificateCredential(ctypes.Structure):
_fields_ = [
("certHash", ctypes.c_ubyte * 20),
("password", ctypes.c_void_p),
]
class EapSimCredential(ctypes.Structure):
_fields_ = [
("iccID", ctypes.c_void_p),
]
class EapCredentialTypeData(ctypes.Structure):
_fields_ = [
("username_password", EapUsernamePasswordCredential),
("certificate", EapCertificateCredential),
("sim", EapSimCredential),
]
class EapCredential(ctypes.Structure):
_fields_ = [
("credType", ctypes.c_int),
("credData", EapCredentialTypeData),
]#[repr(C)]
pub struct EapUsernamePasswordCredential {
pub username: *mut core::ffi::c_void,
pub password: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct EapCertificateCredential {
pub certHash: [u8; 20],
pub password: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct EapSimCredential {
pub iccID: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct EapCredentialTypeData {
pub username_password: EapUsernamePasswordCredential,
pub certificate: EapCertificateCredential,
pub sim: EapSimCredential,
}
#[repr(C)]
pub struct EapCredential {
pub credType: i32,
pub credData: EapCredentialTypeData,
}import "golang.org/x/sys/windows"
type EapUsernamePasswordCredential struct {
username uintptr
password uintptr
}
type EapCertificateCredential struct {
certHash [20]byte
password uintptr
}
type EapSimCredential struct {
iccID uintptr
}
type EapCredentialTypeData struct {
username_password EapUsernamePasswordCredential
certificate EapCertificateCredential
sim EapSimCredential
}
type EapCredential struct {
credType int32
credData EapCredentialTypeData
}type
EapUsernamePasswordCredential = record
username: Pointer;
password: Pointer;
end;
EapCertificateCredential = record
certHash: array[0..19] of Byte;
password: Pointer;
end;
EapSimCredential = record
iccID: Pointer;
end;
EapCredentialTypeData = record
username_password: EapUsernamePasswordCredential;
certificate: EapCertificateCredential;
sim: EapSimCredential;
end;
EapCredential = record
credType: Integer;
credData: EapCredentialTypeData;
end;const EapUsernamePasswordCredential = extern struct {
username: ?*anyopaque,
password: ?*anyopaque,
};
const EapCertificateCredential = extern struct {
certHash: [20]u8,
password: ?*anyopaque,
};
const EapSimCredential = extern struct {
iccID: ?*anyopaque,
};
const EapCredentialTypeData = extern struct {
username_password: EapUsernamePasswordCredential,
certificate: EapCertificateCredential,
sim: EapSimCredential,
};
const EapCredential = extern struct {
credType: i32,
credData: EapCredentialTypeData,
};type
EapUsernamePasswordCredential {.bycopy.} = object
username: pointer
password: pointer
EapCertificateCredential {.bycopy.} = object
certHash: array[20, uint8]
password: pointer
EapSimCredential {.bycopy.} = object
iccID: pointer
EapCredentialTypeData {.bycopy.} = object
username_password: EapUsernamePasswordCredential
certificate: EapCertificateCredential
sim: EapSimCredential
EapCredential {.bycopy.} = object
credType: int32
credData: EapCredentialTypeDatastruct EapUsernamePasswordCredential
{
void* username;
void* password;
}
struct EapCertificateCredential
{
ubyte[20] certHash;
void* password;
}
struct EapSimCredential
{
void* iccID;
}
struct EapCredentialTypeData
{
EapUsernamePasswordCredential username_password;
EapCertificateCredential certificate;
EapSimCredential sim;
}
struct EapCredential
{
int credType;
EapCredentialTypeData credData;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; EapCredential サイズ: 28 バイト(x86)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; credType : EapCredentialType (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; credData : EapCredentialTypeData (+4, 24byte) varptr(st)+4 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EapCredential サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; credType : EapCredentialType (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; credData : EapCredentialTypeData (+8, 32byte) varptr(st)+8 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global EapCredential
#field int credType
#field byte credData 32
#endstruct
stdim st, EapCredential ; NSTRUCT 変数を確保
st->credType = 100
mes "credType=" + st->credType
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。