ホーム › Security.Cryptography › RECIPIENTPOLICY2
RECIPIENTPOLICY2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| recipient | ENDPOINTADDRESS2 | 32/16 | +0 | +0 | トークン受信者のエンドポイントアドレス(版2)。 |
| issuer | ENDPOINTADDRESS2 | 32/16 | +32 | +16 | トークン発行者のエンドポイントアドレス(版2)。 |
| tokenType | LPWSTR | 8/4 | +64 | +32 | 要求するトークンの種別を示すワイド文字列。 |
| requiredClaims | CLAIMLIST | 16/8 | +72 | +36 | 必須クレームのリスト。 |
| optionalClaims | CLAIMLIST | 16/8 | +88 | +44 | 任意クレームのリスト。 |
| privacyUrl | LPWSTR | 8/4 | +104 | +52 | プライバシーポリシーのURLを示すワイド文字列。NULL可。 |
| privacyVersion | DWORD | 4 | +112 | +56 | プライバシーポリシーのバージョン番号。 |
各言語での定義
#include <windows.h>
// ENDPOINTADDRESS2 (x64 32 / x86 16 バイト)
typedef struct ENDPOINTADDRESS2 {
LPWSTR serviceUrl;
LPWSTR policyUrl;
DWORD identityType;
void* identityBytes;
} ENDPOINTADDRESS2;
// CLAIMLIST (x64 16 / x86 8 バイト)
typedef struct CLAIMLIST {
DWORD count;
LPWSTR* claims;
} CLAIMLIST;
// RECIPIENTPOLICY2 (x64 120 / x86 60 バイト)
typedef struct RECIPIENTPOLICY2 {
ENDPOINTADDRESS2 recipient;
ENDPOINTADDRESS2 issuer;
LPWSTR tokenType;
CLAIMLIST requiredClaims;
CLAIMLIST optionalClaims;
LPWSTR privacyUrl;
DWORD privacyVersion;
} RECIPIENTPOLICY2;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ENDPOINTADDRESS2
{
public IntPtr serviceUrl;
public IntPtr policyUrl;
public uint identityType;
public IntPtr identityBytes;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLAIMLIST
{
public uint count;
public IntPtr claims;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECIPIENTPOLICY2
{
public ENDPOINTADDRESS2 recipient;
public ENDPOINTADDRESS2 issuer;
public IntPtr tokenType;
public CLAIMLIST requiredClaims;
public CLAIMLIST optionalClaims;
public IntPtr privacyUrl;
public uint privacyVersion;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ENDPOINTADDRESS2
Public serviceUrl As IntPtr
Public policyUrl As IntPtr
Public identityType As UInteger
Public identityBytes As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLAIMLIST
Public count As UInteger
Public claims As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECIPIENTPOLICY2
Public recipient As ENDPOINTADDRESS2
Public issuer As ENDPOINTADDRESS2
Public tokenType As IntPtr
Public requiredClaims As CLAIMLIST
Public optionalClaims As CLAIMLIST
Public privacyUrl As IntPtr
Public privacyVersion As UInteger
End Structureimport ctypes
from ctypes import wintypes
class ENDPOINTADDRESS2(ctypes.Structure):
_fields_ = [
("serviceUrl", ctypes.c_void_p),
("policyUrl", ctypes.c_void_p),
("identityType", wintypes.DWORD),
("identityBytes", ctypes.c_void_p),
]
class CLAIMLIST(ctypes.Structure):
_fields_ = [
("count", wintypes.DWORD),
("claims", ctypes.c_void_p),
]
class RECIPIENTPOLICY2(ctypes.Structure):
_fields_ = [
("recipient", ENDPOINTADDRESS2),
("issuer", ENDPOINTADDRESS2),
("tokenType", ctypes.c_void_p),
("requiredClaims", CLAIMLIST),
("optionalClaims", CLAIMLIST),
("privacyUrl", ctypes.c_void_p),
("privacyVersion", wintypes.DWORD),
]#[repr(C)]
pub struct ENDPOINTADDRESS2 {
pub serviceUrl: *mut core::ffi::c_void,
pub policyUrl: *mut core::ffi::c_void,
pub identityType: u32,
pub identityBytes: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct CLAIMLIST {
pub count: u32,
pub claims: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct RECIPIENTPOLICY2 {
pub recipient: ENDPOINTADDRESS2,
pub issuer: ENDPOINTADDRESS2,
pub tokenType: *mut core::ffi::c_void,
pub requiredClaims: CLAIMLIST,
pub optionalClaims: CLAIMLIST,
pub privacyUrl: *mut core::ffi::c_void,
pub privacyVersion: u32,
}import "golang.org/x/sys/windows"
type ENDPOINTADDRESS2 struct {
serviceUrl uintptr
policyUrl uintptr
identityType uint32
identityBytes uintptr
}
type CLAIMLIST struct {
count uint32
claims uintptr
}
type RECIPIENTPOLICY2 struct {
recipient ENDPOINTADDRESS2
issuer ENDPOINTADDRESS2
tokenType uintptr
requiredClaims CLAIMLIST
optionalClaims CLAIMLIST
privacyUrl uintptr
privacyVersion uint32
}type
ENDPOINTADDRESS2 = record
serviceUrl: Pointer;
policyUrl: Pointer;
identityType: DWORD;
identityBytes: Pointer;
end;
CLAIMLIST = record
count: DWORD;
claims: Pointer;
end;
RECIPIENTPOLICY2 = record
recipient: ENDPOINTADDRESS2;
issuer: ENDPOINTADDRESS2;
tokenType: Pointer;
requiredClaims: CLAIMLIST;
optionalClaims: CLAIMLIST;
privacyUrl: Pointer;
privacyVersion: DWORD;
end;const ENDPOINTADDRESS2 = extern struct {
serviceUrl: ?*anyopaque,
policyUrl: ?*anyopaque,
identityType: u32,
identityBytes: ?*anyopaque,
};
const CLAIMLIST = extern struct {
count: u32,
claims: ?*anyopaque,
};
const RECIPIENTPOLICY2 = extern struct {
recipient: ENDPOINTADDRESS2,
issuer: ENDPOINTADDRESS2,
tokenType: ?*anyopaque,
requiredClaims: CLAIMLIST,
optionalClaims: CLAIMLIST,
privacyUrl: ?*anyopaque,
privacyVersion: u32,
};type
ENDPOINTADDRESS2 {.bycopy.} = object
serviceUrl: pointer
policyUrl: pointer
identityType: uint32
identityBytes: pointer
CLAIMLIST {.bycopy.} = object
count: uint32
claims: pointer
RECIPIENTPOLICY2 {.bycopy.} = object
recipient: ENDPOINTADDRESS2
issuer: ENDPOINTADDRESS2
tokenType: pointer
requiredClaims: CLAIMLIST
optionalClaims: CLAIMLIST
privacyUrl: pointer
privacyVersion: uint32struct ENDPOINTADDRESS2
{
void* serviceUrl;
void* policyUrl;
uint identityType;
void* identityBytes;
}
struct CLAIMLIST
{
uint count;
void* claims;
}
struct RECIPIENTPOLICY2
{
ENDPOINTADDRESS2 recipient;
ENDPOINTADDRESS2 issuer;
void* tokenType;
CLAIMLIST requiredClaims;
CLAIMLIST optionalClaims;
void* privacyUrl;
uint privacyVersion;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; RECIPIENTPOLICY2 サイズ: 60 バイト(x86)
dim st, 15 ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; recipient : ENDPOINTADDRESS2 (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; issuer : ENDPOINTADDRESS2 (+16, 16byte) varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; tokenType : LPWSTR (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; requiredClaims : CLAIMLIST (+36, 8byte) varptr(st)+36 を基点に操作(8byte:入れ子/配列)
; optionalClaims : CLAIMLIST (+44, 8byte) varptr(st)+44 を基点に操作(8byte:入れ子/配列)
; privacyUrl : LPWSTR (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; privacyVersion : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; RECIPIENTPOLICY2 サイズ: 120 バイト(x64)
dim st, 30 ; 4byte整数×30(構造体サイズ 120 / 4 切り上げ)
; recipient : ENDPOINTADDRESS2 (+0, 32byte) varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; issuer : ENDPOINTADDRESS2 (+32, 32byte) varptr(st)+32 を基点に操作(32byte:入れ子/配列)
; tokenType : LPWSTR (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; requiredClaims : CLAIMLIST (+72, 16byte) varptr(st)+72 を基点に操作(16byte:入れ子/配列)
; optionalClaims : CLAIMLIST (+88, 16byte) varptr(st)+88 を基点に操作(16byte:入れ子/配列)
; privacyUrl : LPWSTR (+104, 8byte) qpoke st,104,値 / qpeek(st,104) ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; privacyVersion : DWORD (+112, 4byte) st.28 = 値 / 値 = st.28 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global ENDPOINTADDRESS2
#field intptr serviceUrl
#field intptr policyUrl
#field int identityType
#field intptr identityBytes
#endstruct
#defstruct global CLAIMLIST
#field int count
#field intptr claims
#endstruct
#defstruct global RECIPIENTPOLICY2
#field ENDPOINTADDRESS2 recipient
#field ENDPOINTADDRESS2 issuer
#field intptr tokenType
#field CLAIMLIST requiredClaims
#field CLAIMLIST optionalClaims
#field intptr privacyUrl
#field int privacyVersion
#endstruct
stdim st, RECIPIENTPOLICY2 ; NSTRUCT 変数を確保
st->privacyVersion = 100
mes "privacyVersion=" + st->privacyVersion