ホーム › Security.Cryptography › CLMD_PIV_PUBLIC_KEY_DATA
CLMD_PIV_PUBLIC_KEY_DATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwVersion | DWORD | 4 | +0 | +0 | PIV公開鍵データ構造体のバージョン番号。 |
| bKeyId | BYTE | 1 | +4 | +4 | 対象鍵の識別子。 |
| pbPublicKey | BYTE* | 8/4 | +8 | +8 | 公開鍵データへのポインタ。 |
| cbPublicKey | DWORD | 4 | +16 | +12 | 公開鍵データのバイト長。 |
各言語での定義
#include <windows.h>
// CLMD_PIV_PUBLIC_KEY_DATA (x64 24 / x86 16 バイト)
typedef struct CLMD_PIV_PUBLIC_KEY_DATA {
DWORD dwVersion;
BYTE bKeyId;
BYTE* pbPublicKey;
DWORD cbPublicKey;
} CLMD_PIV_PUBLIC_KEY_DATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLMD_PIV_PUBLIC_KEY_DATA
{
public uint dwVersion;
public byte bKeyId;
public IntPtr pbPublicKey;
public uint cbPublicKey;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLMD_PIV_PUBLIC_KEY_DATA
Public dwVersion As UInteger
Public bKeyId As Byte
Public pbPublicKey As IntPtr
Public cbPublicKey As UInteger
End Structureimport ctypes
from ctypes import wintypes
class CLMD_PIV_PUBLIC_KEY_DATA(ctypes.Structure):
_fields_ = [
("dwVersion", wintypes.DWORD),
("bKeyId", ctypes.c_ubyte),
("pbPublicKey", ctypes.c_void_p),
("cbPublicKey", wintypes.DWORD),
]#[repr(C)]
pub struct CLMD_PIV_PUBLIC_KEY_DATA {
pub dwVersion: u32,
pub bKeyId: u8,
pub pbPublicKey: *mut core::ffi::c_void,
pub cbPublicKey: u32,
}import "golang.org/x/sys/windows"
type CLMD_PIV_PUBLIC_KEY_DATA struct {
dwVersion uint32
bKeyId byte
pbPublicKey uintptr
cbPublicKey uint32
}type
CLMD_PIV_PUBLIC_KEY_DATA = record
dwVersion: DWORD;
bKeyId: Byte;
pbPublicKey: Pointer;
cbPublicKey: DWORD;
end;const CLMD_PIV_PUBLIC_KEY_DATA = extern struct {
dwVersion: u32,
bKeyId: u8,
pbPublicKey: ?*anyopaque,
cbPublicKey: u32,
};type
CLMD_PIV_PUBLIC_KEY_DATA {.bycopy.} = object
dwVersion: uint32
bKeyId: uint8
pbPublicKey: pointer
cbPublicKey: uint32struct CLMD_PIV_PUBLIC_KEY_DATA
{
uint dwVersion;
ubyte bKeyId;
void* pbPublicKey;
uint cbPublicKey;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CLMD_PIV_PUBLIC_KEY_DATA サイズ: 16 バイト(x86)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; bKeyId : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; pbPublicKey : BYTE* (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cbPublicKey : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CLMD_PIV_PUBLIC_KEY_DATA サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; bKeyId : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; pbPublicKey : BYTE* (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; cbPublicKey : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CLMD_PIV_PUBLIC_KEY_DATA
#field int dwVersion
#field byte bKeyId
#field intptr pbPublicKey
#field int cbPublicKey
#endstruct
stdim st, CLMD_PIV_PUBLIC_KEY_DATA ; NSTRUCT 変数を確保
st->dwVersion = 100
mes "dwVersion=" + st->dwVersion