ホーム › Security.Cryptography › CERT_BASIC_CONSTRAINTS_INFO
CERT_BASIC_CONSTRAINTS_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| SubjectType | CRYPT_BIT_BLOB | 24/12 | +0 | +0 | サブジェクトの種別(CA/エンドエンティティ)を示すビットBLOB。 |
| fPathLenConstraint | BOOL | 4 | +24 | +12 | パス長制約が有効かを示すフラグ。TRUEでdwPathLenConstraintが有効。 |
| dwPathLenConstraint | DWORD | 4 | +28 | +16 | 許容されるCAチェーンの最大パス長。 |
| cSubtreesConstraint | DWORD | 4 | +32 | +20 | サブツリー制約の個数。 |
| rgSubtreesConstraint | CRYPT_INTEGER_BLOB* | 8/4 | +40 | +24 | サブツリー制約名BLOBの配列へのポインタ。 |
各言語での定義
#include <windows.h>
// CRYPT_BIT_BLOB (x64 24 / x86 12 バイト)
typedef struct CRYPT_BIT_BLOB {
DWORD cbData;
BYTE* pbData;
DWORD cUnusedBits;
} CRYPT_BIT_BLOB;
// CERT_BASIC_CONSTRAINTS_INFO (x64 48 / x86 28 バイト)
typedef struct CERT_BASIC_CONSTRAINTS_INFO {
CRYPT_BIT_BLOB SubjectType;
BOOL fPathLenConstraint;
DWORD dwPathLenConstraint;
DWORD cSubtreesConstraint;
CRYPT_INTEGER_BLOB* rgSubtreesConstraint;
} CERT_BASIC_CONSTRAINTS_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CRYPT_BIT_BLOB
{
public uint cbData;
public IntPtr pbData;
public uint cUnusedBits;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CERT_BASIC_CONSTRAINTS_INFO
{
public CRYPT_BIT_BLOB SubjectType;
[MarshalAs(UnmanagedType.Bool)] public bool fPathLenConstraint;
public uint dwPathLenConstraint;
public uint cSubtreesConstraint;
public IntPtr rgSubtreesConstraint;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CRYPT_BIT_BLOB
Public cbData As UInteger
Public pbData As IntPtr
Public cUnusedBits As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CERT_BASIC_CONSTRAINTS_INFO
Public SubjectType As CRYPT_BIT_BLOB
<MarshalAs(UnmanagedType.Bool)> Public fPathLenConstraint As Boolean
Public dwPathLenConstraint As UInteger
Public cSubtreesConstraint As UInteger
Public rgSubtreesConstraint As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class CRYPT_BIT_BLOB(ctypes.Structure):
_fields_ = [
("cbData", wintypes.DWORD),
("pbData", ctypes.c_void_p),
("cUnusedBits", wintypes.DWORD),
]
class CERT_BASIC_CONSTRAINTS_INFO(ctypes.Structure):
_fields_ = [
("SubjectType", CRYPT_BIT_BLOB),
("fPathLenConstraint", wintypes.BOOL),
("dwPathLenConstraint", wintypes.DWORD),
("cSubtreesConstraint", wintypes.DWORD),
("rgSubtreesConstraint", ctypes.c_void_p),
]#[repr(C)]
pub struct CRYPT_BIT_BLOB {
pub cbData: u32,
pub pbData: *mut core::ffi::c_void,
pub cUnusedBits: u32,
}
#[repr(C)]
pub struct CERT_BASIC_CONSTRAINTS_INFO {
pub SubjectType: CRYPT_BIT_BLOB,
pub fPathLenConstraint: i32,
pub dwPathLenConstraint: u32,
pub cSubtreesConstraint: u32,
pub rgSubtreesConstraint: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type CRYPT_BIT_BLOB struct {
cbData uint32
pbData uintptr
cUnusedBits uint32
}
type CERT_BASIC_CONSTRAINTS_INFO struct {
SubjectType CRYPT_BIT_BLOB
fPathLenConstraint int32
dwPathLenConstraint uint32
cSubtreesConstraint uint32
rgSubtreesConstraint uintptr
}type
CRYPT_BIT_BLOB = record
cbData: DWORD;
pbData: Pointer;
cUnusedBits: DWORD;
end;
CERT_BASIC_CONSTRAINTS_INFO = record
SubjectType: CRYPT_BIT_BLOB;
fPathLenConstraint: BOOL;
dwPathLenConstraint: DWORD;
cSubtreesConstraint: DWORD;
rgSubtreesConstraint: Pointer;
end;const CRYPT_BIT_BLOB = extern struct {
cbData: u32,
pbData: ?*anyopaque,
cUnusedBits: u32,
};
const CERT_BASIC_CONSTRAINTS_INFO = extern struct {
SubjectType: CRYPT_BIT_BLOB,
fPathLenConstraint: i32,
dwPathLenConstraint: u32,
cSubtreesConstraint: u32,
rgSubtreesConstraint: ?*anyopaque,
};type
CRYPT_BIT_BLOB {.bycopy.} = object
cbData: uint32
pbData: pointer
cUnusedBits: uint32
CERT_BASIC_CONSTRAINTS_INFO {.bycopy.} = object
SubjectType: CRYPT_BIT_BLOB
fPathLenConstraint: int32
dwPathLenConstraint: uint32
cSubtreesConstraint: uint32
rgSubtreesConstraint: pointerstruct CRYPT_BIT_BLOB
{
uint cbData;
void* pbData;
uint cUnusedBits;
}
struct CERT_BASIC_CONSTRAINTS_INFO
{
CRYPT_BIT_BLOB SubjectType;
int fPathLenConstraint;
uint dwPathLenConstraint;
uint cSubtreesConstraint;
void* rgSubtreesConstraint;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CERT_BASIC_CONSTRAINTS_INFO サイズ: 28 バイト(x86)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; SubjectType : CRYPT_BIT_BLOB (+0, 12byte) varptr(st)+0 を基点に操作(12byte:入れ子/配列)
; fPathLenConstraint : BOOL (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwPathLenConstraint : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; cSubtreesConstraint : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; rgSubtreesConstraint : CRYPT_INTEGER_BLOB* (+24, 4byte) varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CERT_BASIC_CONSTRAINTS_INFO サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; SubjectType : CRYPT_BIT_BLOB (+0, 24byte) varptr(st)+0 を基点に操作(24byte:入れ子/配列)
; fPathLenConstraint : BOOL (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwPathLenConstraint : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; cSubtreesConstraint : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; rgSubtreesConstraint : CRYPT_INTEGER_BLOB* (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global CRYPT_BIT_BLOB
#field int cbData
#field intptr pbData
#field int cUnusedBits
#endstruct
#defstruct global CERT_BASIC_CONSTRAINTS_INFO
#field CRYPT_BIT_BLOB SubjectType
#field bool fPathLenConstraint
#field int dwPathLenConstraint
#field int cSubtreesConstraint
#field intptr rgSubtreesConstraint
#endstruct
stdim st, CERT_BASIC_CONSTRAINTS_INFO ; NSTRUCT 変数を確保
st->fPathLenConstraint = 100
mes "fPathLenConstraint=" + st->fPathLenConstraint