ホーム › Security.Cryptography › BCryptDestroyKey
BCryptDestroyKey
関数CNGの鍵オブジェクトを破棄する。
シグネチャ
// bcrypt.dll
#include <windows.h>
NTSTATUS BCryptDestroyKey(
BCRYPT_KEY_HANDLE hKey
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hKey | BCRYPT_KEY_HANDLE | inout |
戻り値の型: NTSTATUS
各言語での呼び出し定義
// bcrypt.dll
#include <windows.h>
NTSTATUS BCryptDestroyKey(
BCRYPT_KEY_HANDLE hKey
);[DllImport("bcrypt.dll", ExactSpelling = true)]
static extern int BCryptDestroyKey(
IntPtr hKey // BCRYPT_KEY_HANDLE in/out
);<DllImport("bcrypt.dll", ExactSpelling:=True)>
Public Shared Function BCryptDestroyKey(
hKey As IntPtr ' BCRYPT_KEY_HANDLE in/out
) As Integer
End Function' hKey : BCRYPT_KEY_HANDLE in/out
Declare PtrSafe Function BCryptDestroyKey Lib "bcrypt" ( _
ByVal hKey As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
BCryptDestroyKey = ctypes.windll.bcrypt.BCryptDestroyKey
BCryptDestroyKey.restype = ctypes.c_int
BCryptDestroyKey.argtypes = [
wintypes.HANDLE, # hKey : BCRYPT_KEY_HANDLE in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('bcrypt.dll')
BCryptDestroyKey = Fiddle::Function.new(
lib['BCryptDestroyKey'],
[
Fiddle::TYPE_VOIDP, # hKey : BCRYPT_KEY_HANDLE in/out
],
Fiddle::TYPE_INT)#[link(name = "bcrypt")]
extern "system" {
fn BCryptDestroyKey(
hKey: *mut core::ffi::c_void // BCRYPT_KEY_HANDLE in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("bcrypt.dll")]
public static extern int BCryptDestroyKey(IntPtr hKey);
"@
$api = Add-Type -MemberDefinition $sig -Name 'bcrypt_BCryptDestroyKey' -Namespace Win32 -PassThru
# $api::BCryptDestroyKey(hKey)#uselib "bcrypt.dll"
#func global BCryptDestroyKey "BCryptDestroyKey" sptr
; BCryptDestroyKey hKey ; 戻り値は stat
; hKey : BCRYPT_KEY_HANDLE in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "bcrypt.dll"
#cfunc global BCryptDestroyKey "BCryptDestroyKey" sptr
; res = BCryptDestroyKey(hKey)
; hKey : BCRYPT_KEY_HANDLE in/out -> "sptr"; NTSTATUS BCryptDestroyKey(BCRYPT_KEY_HANDLE hKey)
#uselib "bcrypt.dll"
#cfunc global BCryptDestroyKey "BCryptDestroyKey" intptr
; res = BCryptDestroyKey(hKey)
; hKey : BCRYPT_KEY_HANDLE in/out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
bcrypt = windows.NewLazySystemDLL("bcrypt.dll")
procBCryptDestroyKey = bcrypt.NewProc("BCryptDestroyKey")
)
// hKey (BCRYPT_KEY_HANDLE in/out)
r1, _, err := procBCryptDestroyKey.Call(
uintptr(hKey),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // NTSTATUSfunction BCryptDestroyKey(
hKey: THandle // BCRYPT_KEY_HANDLE in/out
): Integer; stdcall;
external 'bcrypt.dll' name 'BCryptDestroyKey';result := DllCall("bcrypt\BCryptDestroyKey"
, "Ptr", hKey ; BCRYPT_KEY_HANDLE in/out
, "Int") ; return: NTSTATUS●BCryptDestroyKey(hKey) = DLL("bcrypt.dll", "int BCryptDestroyKey(void*)")
# 呼び出し: BCryptDestroyKey(hKey)
# hKey : BCRYPT_KEY_HANDLE in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。