ホーム › System.Environment › EnclaveUnsealData
EnclaveUnsealData
関数封印されたエンクレーブデータを復号し展開する。
シグネチャ
// vertdll.dll
#include <windows.h>
HRESULT EnclaveUnsealData(
const void* ProtectedBlob,
DWORD ProtectedBlobSize,
void* DecryptedData, // optional
DWORD BufferSize,
DWORD* DecryptedDataSize,
ENCLAVE_IDENTITY* SealingIdentity, // optional
DWORD* UnsealingFlags // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ProtectedBlob | void* | in |
| ProtectedBlobSize | DWORD | in |
| DecryptedData | void* | outoptional |
| BufferSize | DWORD | in |
| DecryptedDataSize | DWORD* | out |
| SealingIdentity | ENCLAVE_IDENTITY* | outoptional |
| UnsealingFlags | DWORD* | outoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// vertdll.dll
#include <windows.h>
HRESULT EnclaveUnsealData(
const void* ProtectedBlob,
DWORD ProtectedBlobSize,
void* DecryptedData, // optional
DWORD BufferSize,
DWORD* DecryptedDataSize,
ENCLAVE_IDENTITY* SealingIdentity, // optional
DWORD* UnsealingFlags // optional
);[DllImport("vertdll.dll", ExactSpelling = true)]
static extern int EnclaveUnsealData(
IntPtr ProtectedBlob, // void*
uint ProtectedBlobSize, // DWORD
IntPtr DecryptedData, // void* optional, out
uint BufferSize, // DWORD
out uint DecryptedDataSize, // DWORD* out
IntPtr SealingIdentity, // ENCLAVE_IDENTITY* optional, out
IntPtr UnsealingFlags // DWORD* optional, out
);<DllImport("vertdll.dll", ExactSpelling:=True)>
Public Shared Function EnclaveUnsealData(
ProtectedBlob As IntPtr, ' void*
ProtectedBlobSize As UInteger, ' DWORD
DecryptedData As IntPtr, ' void* optional, out
BufferSize As UInteger, ' DWORD
<Out> ByRef DecryptedDataSize As UInteger, ' DWORD* out
SealingIdentity As IntPtr, ' ENCLAVE_IDENTITY* optional, out
UnsealingFlags As IntPtr ' DWORD* optional, out
) As Integer
End Function' ProtectedBlob : void*
' ProtectedBlobSize : DWORD
' DecryptedData : void* optional, out
' BufferSize : DWORD
' DecryptedDataSize : DWORD* out
' SealingIdentity : ENCLAVE_IDENTITY* optional, out
' UnsealingFlags : DWORD* optional, out
Declare PtrSafe Function EnclaveUnsealData Lib "vertdll" ( _
ByVal ProtectedBlob As LongPtr, _
ByVal ProtectedBlobSize As Long, _
ByVal DecryptedData As LongPtr, _
ByVal BufferSize As Long, _
ByRef DecryptedDataSize As Long, _
ByVal SealingIdentity As LongPtr, _
ByVal UnsealingFlags As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
EnclaveUnsealData = ctypes.windll.vertdll.EnclaveUnsealData
EnclaveUnsealData.restype = ctypes.c_int
EnclaveUnsealData.argtypes = [
ctypes.POINTER(None), # ProtectedBlob : void*
wintypes.DWORD, # ProtectedBlobSize : DWORD
ctypes.POINTER(None), # DecryptedData : void* optional, out
wintypes.DWORD, # BufferSize : DWORD
ctypes.POINTER(wintypes.DWORD), # DecryptedDataSize : DWORD* out
ctypes.c_void_p, # SealingIdentity : ENCLAVE_IDENTITY* optional, out
ctypes.POINTER(wintypes.DWORD), # UnsealingFlags : DWORD* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('vertdll.dll')
EnclaveUnsealData = Fiddle::Function.new(
lib['EnclaveUnsealData'],
[
Fiddle::TYPE_VOIDP, # ProtectedBlob : void*
-Fiddle::TYPE_INT, # ProtectedBlobSize : DWORD
Fiddle::TYPE_VOIDP, # DecryptedData : void* optional, out
-Fiddle::TYPE_INT, # BufferSize : DWORD
Fiddle::TYPE_VOIDP, # DecryptedDataSize : DWORD* out
Fiddle::TYPE_VOIDP, # SealingIdentity : ENCLAVE_IDENTITY* optional, out
Fiddle::TYPE_VOIDP, # UnsealingFlags : DWORD* optional, out
],
Fiddle::TYPE_INT)#[link(name = "vertdll")]
extern "system" {
fn EnclaveUnsealData(
ProtectedBlob: *const (), // void*
ProtectedBlobSize: u32, // DWORD
DecryptedData: *mut (), // void* optional, out
BufferSize: u32, // DWORD
DecryptedDataSize: *mut u32, // DWORD* out
SealingIdentity: *mut ENCLAVE_IDENTITY, // ENCLAVE_IDENTITY* optional, out
UnsealingFlags: *mut u32 // DWORD* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("vertdll.dll")]
public static extern int EnclaveUnsealData(IntPtr ProtectedBlob, uint ProtectedBlobSize, IntPtr DecryptedData, uint BufferSize, out uint DecryptedDataSize, IntPtr SealingIdentity, IntPtr UnsealingFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'vertdll_EnclaveUnsealData' -Namespace Win32 -PassThru
# $api::EnclaveUnsealData(ProtectedBlob, ProtectedBlobSize, DecryptedData, BufferSize, DecryptedDataSize, SealingIdentity, UnsealingFlags)#uselib "vertdll.dll"
#func global EnclaveUnsealData "EnclaveUnsealData" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; EnclaveUnsealData ProtectedBlob, ProtectedBlobSize, DecryptedData, BufferSize, varptr(DecryptedDataSize), varptr(SealingIdentity), varptr(UnsealingFlags) ; 戻り値は stat
; ProtectedBlob : void* -> "sptr"
; ProtectedBlobSize : DWORD -> "sptr"
; DecryptedData : void* optional, out -> "sptr"
; BufferSize : DWORD -> "sptr"
; DecryptedDataSize : DWORD* out -> "sptr"
; SealingIdentity : ENCLAVE_IDENTITY* optional, out -> "sptr"
; UnsealingFlags : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "vertdll.dll" #cfunc global EnclaveUnsealData "EnclaveUnsealData" sptr, int, sptr, int, var, var, var ; res = EnclaveUnsealData(ProtectedBlob, ProtectedBlobSize, DecryptedData, BufferSize, DecryptedDataSize, SealingIdentity, UnsealingFlags) ; ProtectedBlob : void* -> "sptr" ; ProtectedBlobSize : DWORD -> "int" ; DecryptedData : void* optional, out -> "sptr" ; BufferSize : DWORD -> "int" ; DecryptedDataSize : DWORD* out -> "var" ; SealingIdentity : ENCLAVE_IDENTITY* optional, out -> "var" ; UnsealingFlags : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "vertdll.dll" #cfunc global EnclaveUnsealData "EnclaveUnsealData" sptr, int, sptr, int, sptr, sptr, sptr ; res = EnclaveUnsealData(ProtectedBlob, ProtectedBlobSize, DecryptedData, BufferSize, varptr(DecryptedDataSize), varptr(SealingIdentity), varptr(UnsealingFlags)) ; ProtectedBlob : void* -> "sptr" ; ProtectedBlobSize : DWORD -> "int" ; DecryptedData : void* optional, out -> "sptr" ; BufferSize : DWORD -> "int" ; DecryptedDataSize : DWORD* out -> "sptr" ; SealingIdentity : ENCLAVE_IDENTITY* optional, out -> "sptr" ; UnsealingFlags : DWORD* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT EnclaveUnsealData(void* ProtectedBlob, DWORD ProtectedBlobSize, void* DecryptedData, DWORD BufferSize, DWORD* DecryptedDataSize, ENCLAVE_IDENTITY* SealingIdentity, DWORD* UnsealingFlags) #uselib "vertdll.dll" #cfunc global EnclaveUnsealData "EnclaveUnsealData" intptr, int, intptr, int, var, var, var ; res = EnclaveUnsealData(ProtectedBlob, ProtectedBlobSize, DecryptedData, BufferSize, DecryptedDataSize, SealingIdentity, UnsealingFlags) ; ProtectedBlob : void* -> "intptr" ; ProtectedBlobSize : DWORD -> "int" ; DecryptedData : void* optional, out -> "intptr" ; BufferSize : DWORD -> "int" ; DecryptedDataSize : DWORD* out -> "var" ; SealingIdentity : ENCLAVE_IDENTITY* optional, out -> "var" ; UnsealingFlags : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT EnclaveUnsealData(void* ProtectedBlob, DWORD ProtectedBlobSize, void* DecryptedData, DWORD BufferSize, DWORD* DecryptedDataSize, ENCLAVE_IDENTITY* SealingIdentity, DWORD* UnsealingFlags) #uselib "vertdll.dll" #cfunc global EnclaveUnsealData "EnclaveUnsealData" intptr, int, intptr, int, intptr, intptr, intptr ; res = EnclaveUnsealData(ProtectedBlob, ProtectedBlobSize, DecryptedData, BufferSize, varptr(DecryptedDataSize), varptr(SealingIdentity), varptr(UnsealingFlags)) ; ProtectedBlob : void* -> "intptr" ; ProtectedBlobSize : DWORD -> "int" ; DecryptedData : void* optional, out -> "intptr" ; BufferSize : DWORD -> "int" ; DecryptedDataSize : DWORD* out -> "intptr" ; SealingIdentity : ENCLAVE_IDENTITY* optional, out -> "intptr" ; UnsealingFlags : DWORD* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
vertdll = windows.NewLazySystemDLL("vertdll.dll")
procEnclaveUnsealData = vertdll.NewProc("EnclaveUnsealData")
)
// ProtectedBlob (void*), ProtectedBlobSize (DWORD), DecryptedData (void* optional, out), BufferSize (DWORD), DecryptedDataSize (DWORD* out), SealingIdentity (ENCLAVE_IDENTITY* optional, out), UnsealingFlags (DWORD* optional, out)
r1, _, err := procEnclaveUnsealData.Call(
uintptr(ProtectedBlob),
uintptr(ProtectedBlobSize),
uintptr(DecryptedData),
uintptr(BufferSize),
uintptr(DecryptedDataSize),
uintptr(SealingIdentity),
uintptr(UnsealingFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction EnclaveUnsealData(
ProtectedBlob: Pointer; // void*
ProtectedBlobSize: DWORD; // DWORD
DecryptedData: Pointer; // void* optional, out
BufferSize: DWORD; // DWORD
DecryptedDataSize: Pointer; // DWORD* out
SealingIdentity: Pointer; // ENCLAVE_IDENTITY* optional, out
UnsealingFlags: Pointer // DWORD* optional, out
): Integer; stdcall;
external 'vertdll.dll' name 'EnclaveUnsealData';result := DllCall("vertdll\EnclaveUnsealData"
, "Ptr", ProtectedBlob ; void*
, "UInt", ProtectedBlobSize ; DWORD
, "Ptr", DecryptedData ; void* optional, out
, "UInt", BufferSize ; DWORD
, "Ptr", DecryptedDataSize ; DWORD* out
, "Ptr", SealingIdentity ; ENCLAVE_IDENTITY* optional, out
, "Ptr", UnsealingFlags ; DWORD* optional, out
, "Int") ; return: HRESULT●EnclaveUnsealData(ProtectedBlob, ProtectedBlobSize, DecryptedData, BufferSize, DecryptedDataSize, SealingIdentity, UnsealingFlags) = DLL("vertdll.dll", "int EnclaveUnsealData(void*, dword, void*, dword, void*, void*, void*)")
# 呼び出し: EnclaveUnsealData(ProtectedBlob, ProtectedBlobSize, DecryptedData, BufferSize, DecryptedDataSize, SealingIdentity, UnsealingFlags)
# ProtectedBlob : void* -> "void*"
# ProtectedBlobSize : DWORD -> "dword"
# DecryptedData : void* optional, out -> "void*"
# BufferSize : DWORD -> "dword"
# DecryptedDataSize : DWORD* out -> "void*"
# SealingIdentity : ENCLAVE_IDENTITY* optional, out -> "void*"
# UnsealingFlags : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。