Win32 API 日本語リファレンス
ホームSystem.Environment › EnclaveUnsealData

EnclaveUnsealData

関数
封印されたエンクレーブデータを復号し展開する。
DLLvertdll.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

// 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
);

パラメーター

名前方向
ProtectedBlobvoid*in
ProtectedBlobSizeDWORDin
DecryptedDatavoid*outoptional
BufferSizeDWORDin
DecryptedDataSizeDWORD*out
SealingIdentityENCLAVE_IDENTITY*outoptional
UnsealingFlagsDWORD*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 方式にも切替可。
出力引数:
; 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 方式にも切替可。
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   // HRESULT
function 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)。