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