ホーム › Security.Cryptography › CERT_BASIC_CONSTRAINTS2_INFO
CERT_BASIC_CONSTRAINTS2_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| fCA | BOOL | 4 | +0 | +0 | サブジェクトがCAであるかを示すフラグ。TRUEでCA証明書。 |
| fPathLenConstraint | BOOL | 4 | +4 | +4 | パス長制約が有効かを示すフラグ。TRUEでdwPathLenConstraintが有効。 |
| dwPathLenConstraint | DWORD | 4 | +8 | +8 | 許容される下位CAチェーンの最大パス長。 |
各言語での定義
#include <windows.h>
// CERT_BASIC_CONSTRAINTS2_INFO (x64 12 / x86 12 バイト)
typedef struct CERT_BASIC_CONSTRAINTS2_INFO {
BOOL fCA;
BOOL fPathLenConstraint;
DWORD dwPathLenConstraint;
} CERT_BASIC_CONSTRAINTS2_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CERT_BASIC_CONSTRAINTS2_INFO
{
[MarshalAs(UnmanagedType.Bool)] public bool fCA;
[MarshalAs(UnmanagedType.Bool)] public bool fPathLenConstraint;
public uint dwPathLenConstraint;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CERT_BASIC_CONSTRAINTS2_INFO
<MarshalAs(UnmanagedType.Bool)> Public fCA As Boolean
<MarshalAs(UnmanagedType.Bool)> Public fPathLenConstraint As Boolean
Public dwPathLenConstraint As UInteger
End Structureimport ctypes
from ctypes import wintypes
class CERT_BASIC_CONSTRAINTS2_INFO(ctypes.Structure):
_fields_ = [
("fCA", wintypes.BOOL),
("fPathLenConstraint", wintypes.BOOL),
("dwPathLenConstraint", wintypes.DWORD),
]#[repr(C)]
pub struct CERT_BASIC_CONSTRAINTS2_INFO {
pub fCA: i32,
pub fPathLenConstraint: i32,
pub dwPathLenConstraint: u32,
}import "golang.org/x/sys/windows"
type CERT_BASIC_CONSTRAINTS2_INFO struct {
fCA int32
fPathLenConstraint int32
dwPathLenConstraint uint32
}type
CERT_BASIC_CONSTRAINTS2_INFO = record
fCA: BOOL;
fPathLenConstraint: BOOL;
dwPathLenConstraint: DWORD;
end;const CERT_BASIC_CONSTRAINTS2_INFO = extern struct {
fCA: i32,
fPathLenConstraint: i32,
dwPathLenConstraint: u32,
};type
CERT_BASIC_CONSTRAINTS2_INFO {.bycopy.} = object
fCA: int32
fPathLenConstraint: int32
dwPathLenConstraint: uint32struct CERT_BASIC_CONSTRAINTS2_INFO
{
int fCA;
int fPathLenConstraint;
uint dwPathLenConstraint;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CERT_BASIC_CONSTRAINTS2_INFO サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; fCA : BOOL (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; fPathLenConstraint : BOOL (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwPathLenConstraint : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CERT_BASIC_CONSTRAINTS2_INFO
#field bool fCA
#field bool fPathLenConstraint
#field int dwPathLenConstraint
#endstruct
stdim st, CERT_BASIC_CONSTRAINTS2_INFO ; NSTRUCT 変数を確保
st->fCA = 100
mes "fCA=" + st->fCA