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