ホーム › Security.Cryptography › CryptMsgGetAndVerifySigner
CryptMsgGetAndVerifySigner
関数暗号化メッセージから署名者証明書を取得し署名を検証する。
シグネチャ
// CRYPT32.dll
#include <windows.h>
BOOL CryptMsgGetAndVerifySigner(
void* hCryptMsg,
DWORD cSignerStore,
HCERTSTORE* rghSignerStore, // optional
DWORD dwFlags,
CERT_CONTEXT** ppSigner, // optional
DWORD* pdwSignerIndex // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hCryptMsg | void* | in | 暗号化メッセージのハンドル。 |
| cSignerStore | DWORD | in | rghSignerStore 配列内のストアの数。 |
| rghSignerStore | HCERTSTORE* | inoptional | 署名者の証明書を検索できる証明書ストアハンドルの配列。 |
| dwFlags | DWORD | in | 関数の特定の用途を指定します。 |
| ppSigner | CERT_CONTEXT** | outoptional | 署名が検証されると、ppSigner は署名者の証明書コンテキストを指すように更新されます。証明書の使用を終えたら、CertFreeCertificateContext 関数を呼び出してコンテキストを解放してください。アプリケーションが署名者の証明書を必要としない場合、このパラメーターは NULL にできます。 |
| pdwSignerIndex | DWORD* | inoutoptional | 署名が検証されると、pdwSigner は署名者配列内における署名者のインデックスを指すように更新されます。アプリケーションが署名者のインデックスを必要としない場合、このパラメーターは NULL にできます。 |
戻り値の型: BOOL
公式ドキュメント
CryptMsgGetAndVerifySigner 関数は、暗号化メッセージの署名を検証します。
戻り値
関数が成功した場合、戻り値は 0 以外 (TRUE) です。
関数が失敗した場合、戻り値は 0 (FALSE) です。拡張エラー情報を取得するには、GetLastError を呼び出します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// CRYPT32.dll
#include <windows.h>
BOOL CryptMsgGetAndVerifySigner(
void* hCryptMsg,
DWORD cSignerStore,
HCERTSTORE* rghSignerStore, // optional
DWORD dwFlags,
CERT_CONTEXT** ppSigner, // optional
DWORD* pdwSignerIndex // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool CryptMsgGetAndVerifySigner(
IntPtr hCryptMsg, // void*
uint cSignerStore, // DWORD
IntPtr rghSignerStore, // HCERTSTORE* optional
uint dwFlags, // DWORD
IntPtr ppSigner, // CERT_CONTEXT** optional, out
IntPtr pdwSignerIndex // DWORD* optional, in/out
);<DllImport("CRYPT32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CryptMsgGetAndVerifySigner(
hCryptMsg As IntPtr, ' void*
cSignerStore As UInteger, ' DWORD
rghSignerStore As IntPtr, ' HCERTSTORE* optional
dwFlags As UInteger, ' DWORD
ppSigner As IntPtr, ' CERT_CONTEXT** optional, out
pdwSignerIndex As IntPtr ' DWORD* optional, in/out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hCryptMsg : void*
' cSignerStore : DWORD
' rghSignerStore : HCERTSTORE* optional
' dwFlags : DWORD
' ppSigner : CERT_CONTEXT** optional, out
' pdwSignerIndex : DWORD* optional, in/out
Declare PtrSafe Function CryptMsgGetAndVerifySigner Lib "crypt32" ( _
ByVal hCryptMsg As LongPtr, _
ByVal cSignerStore As Long, _
ByVal rghSignerStore As LongPtr, _
ByVal dwFlags As Long, _
ByVal ppSigner As LongPtr, _
ByVal pdwSignerIndex As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CryptMsgGetAndVerifySigner = ctypes.windll.crypt32.CryptMsgGetAndVerifySigner
CryptMsgGetAndVerifySigner.restype = wintypes.BOOL
CryptMsgGetAndVerifySigner.argtypes = [
ctypes.POINTER(None), # hCryptMsg : void*
wintypes.DWORD, # cSignerStore : DWORD
ctypes.c_void_p, # rghSignerStore : HCERTSTORE* optional
wintypes.DWORD, # dwFlags : DWORD
ctypes.c_void_p, # ppSigner : CERT_CONTEXT** optional, out
ctypes.POINTER(wintypes.DWORD), # pdwSignerIndex : DWORD* optional, in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CRYPT32.dll')
CryptMsgGetAndVerifySigner = Fiddle::Function.new(
lib['CryptMsgGetAndVerifySigner'],
[
Fiddle::TYPE_VOIDP, # hCryptMsg : void*
-Fiddle::TYPE_INT, # cSignerStore : DWORD
Fiddle::TYPE_VOIDP, # rghSignerStore : HCERTSTORE* optional
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_VOIDP, # ppSigner : CERT_CONTEXT** optional, out
Fiddle::TYPE_VOIDP, # pdwSignerIndex : DWORD* optional, in/out
],
Fiddle::TYPE_INT)#[link(name = "crypt32")]
extern "system" {
fn CryptMsgGetAndVerifySigner(
hCryptMsg: *mut (), // void*
cSignerStore: u32, // DWORD
rghSignerStore: *mut *mut core::ffi::c_void, // HCERTSTORE* optional
dwFlags: u32, // DWORD
ppSigner: *mut *mut CERT_CONTEXT, // CERT_CONTEXT** optional, out
pdwSignerIndex: *mut u32 // DWORD* optional, in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", SetLastError = true)]
public static extern bool CryptMsgGetAndVerifySigner(IntPtr hCryptMsg, uint cSignerStore, IntPtr rghSignerStore, uint dwFlags, IntPtr ppSigner, IntPtr pdwSignerIndex);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CryptMsgGetAndVerifySigner' -Namespace Win32 -PassThru
# $api::CryptMsgGetAndVerifySigner(hCryptMsg, cSignerStore, rghSignerStore, dwFlags, ppSigner, pdwSignerIndex)#uselib "CRYPT32.dll"
#func global CryptMsgGetAndVerifySigner "CryptMsgGetAndVerifySigner" sptr, sptr, sptr, sptr, sptr, sptr
; CryptMsgGetAndVerifySigner hCryptMsg, cSignerStore, rghSignerStore, dwFlags, varptr(ppSigner), varptr(pdwSignerIndex) ; 戻り値は stat
; hCryptMsg : void* -> "sptr"
; cSignerStore : DWORD -> "sptr"
; rghSignerStore : HCERTSTORE* optional -> "sptr"
; dwFlags : DWORD -> "sptr"
; ppSigner : CERT_CONTEXT** optional, out -> "sptr"
; pdwSignerIndex : DWORD* optional, in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CRYPT32.dll" #cfunc global CryptMsgGetAndVerifySigner "CryptMsgGetAndVerifySigner" sptr, int, sptr, int, var, var ; res = CryptMsgGetAndVerifySigner(hCryptMsg, cSignerStore, rghSignerStore, dwFlags, ppSigner, pdwSignerIndex) ; hCryptMsg : void* -> "sptr" ; cSignerStore : DWORD -> "int" ; rghSignerStore : HCERTSTORE* optional -> "sptr" ; dwFlags : DWORD -> "int" ; ppSigner : CERT_CONTEXT** optional, out -> "var" ; pdwSignerIndex : DWORD* optional, in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CRYPT32.dll" #cfunc global CryptMsgGetAndVerifySigner "CryptMsgGetAndVerifySigner" sptr, int, sptr, int, sptr, sptr ; res = CryptMsgGetAndVerifySigner(hCryptMsg, cSignerStore, rghSignerStore, dwFlags, varptr(ppSigner), varptr(pdwSignerIndex)) ; hCryptMsg : void* -> "sptr" ; cSignerStore : DWORD -> "int" ; rghSignerStore : HCERTSTORE* optional -> "sptr" ; dwFlags : DWORD -> "int" ; ppSigner : CERT_CONTEXT** optional, out -> "sptr" ; pdwSignerIndex : DWORD* optional, in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL CryptMsgGetAndVerifySigner(void* hCryptMsg, DWORD cSignerStore, HCERTSTORE* rghSignerStore, DWORD dwFlags, CERT_CONTEXT** ppSigner, DWORD* pdwSignerIndex) #uselib "CRYPT32.dll" #cfunc global CryptMsgGetAndVerifySigner "CryptMsgGetAndVerifySigner" intptr, int, intptr, int, var, var ; res = CryptMsgGetAndVerifySigner(hCryptMsg, cSignerStore, rghSignerStore, dwFlags, ppSigner, pdwSignerIndex) ; hCryptMsg : void* -> "intptr" ; cSignerStore : DWORD -> "int" ; rghSignerStore : HCERTSTORE* optional -> "intptr" ; dwFlags : DWORD -> "int" ; ppSigner : CERT_CONTEXT** optional, out -> "var" ; pdwSignerIndex : DWORD* optional, in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL CryptMsgGetAndVerifySigner(void* hCryptMsg, DWORD cSignerStore, HCERTSTORE* rghSignerStore, DWORD dwFlags, CERT_CONTEXT** ppSigner, DWORD* pdwSignerIndex) #uselib "CRYPT32.dll" #cfunc global CryptMsgGetAndVerifySigner "CryptMsgGetAndVerifySigner" intptr, int, intptr, int, intptr, intptr ; res = CryptMsgGetAndVerifySigner(hCryptMsg, cSignerStore, rghSignerStore, dwFlags, varptr(ppSigner), varptr(pdwSignerIndex)) ; hCryptMsg : void* -> "intptr" ; cSignerStore : DWORD -> "int" ; rghSignerStore : HCERTSTORE* optional -> "intptr" ; dwFlags : DWORD -> "int" ; ppSigner : CERT_CONTEXT** optional, out -> "intptr" ; pdwSignerIndex : DWORD* optional, in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
procCryptMsgGetAndVerifySigner = crypt32.NewProc("CryptMsgGetAndVerifySigner")
)
// hCryptMsg (void*), cSignerStore (DWORD), rghSignerStore (HCERTSTORE* optional), dwFlags (DWORD), ppSigner (CERT_CONTEXT** optional, out), pdwSignerIndex (DWORD* optional, in/out)
r1, _, err := procCryptMsgGetAndVerifySigner.Call(
uintptr(hCryptMsg),
uintptr(cSignerStore),
uintptr(rghSignerStore),
uintptr(dwFlags),
uintptr(ppSigner),
uintptr(pdwSignerIndex),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CryptMsgGetAndVerifySigner(
hCryptMsg: Pointer; // void*
cSignerStore: DWORD; // DWORD
rghSignerStore: Pointer; // HCERTSTORE* optional
dwFlags: DWORD; // DWORD
ppSigner: Pointer; // CERT_CONTEXT** optional, out
pdwSignerIndex: Pointer // DWORD* optional, in/out
): BOOL; stdcall;
external 'CRYPT32.dll' name 'CryptMsgGetAndVerifySigner';result := DllCall("CRYPT32\CryptMsgGetAndVerifySigner"
, "Ptr", hCryptMsg ; void*
, "UInt", cSignerStore ; DWORD
, "Ptr", rghSignerStore ; HCERTSTORE* optional
, "UInt", dwFlags ; DWORD
, "Ptr", ppSigner ; CERT_CONTEXT** optional, out
, "Ptr", pdwSignerIndex ; DWORD* optional, in/out
, "Int") ; return: BOOL●CryptMsgGetAndVerifySigner(hCryptMsg, cSignerStore, rghSignerStore, dwFlags, ppSigner, pdwSignerIndex) = DLL("CRYPT32.dll", "bool CryptMsgGetAndVerifySigner(void*, dword, void*, dword, void*, void*)")
# 呼び出し: CryptMsgGetAndVerifySigner(hCryptMsg, cSignerStore, rghSignerStore, dwFlags, ppSigner, pdwSignerIndex)
# hCryptMsg : void* -> "void*"
# cSignerStore : DWORD -> "dword"
# rghSignerStore : HCERTSTORE* optional -> "void*"
# dwFlags : DWORD -> "dword"
# ppSigner : CERT_CONTEXT** optional, out -> "void*"
# pdwSignerIndex : DWORD* optional, in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "crypt32" fn CryptMsgGetAndVerifySigner(
hCryptMsg: ?*anyopaque, // void*
cSignerStore: u32, // DWORD
rghSignerStore: ?*anyopaque, // HCERTSTORE* optional
dwFlags: u32, // DWORD
ppSigner: [*c][*c]CERT_CONTEXT, // CERT_CONTEXT** optional, out
pdwSignerIndex: [*c]u32 // DWORD* optional, in/out
) callconv(std.os.windows.WINAPI) i32;proc CryptMsgGetAndVerifySigner(
hCryptMsg: pointer, # void*
cSignerStore: uint32, # DWORD
rghSignerStore: pointer, # HCERTSTORE* optional
dwFlags: uint32, # DWORD
ppSigner: ptr CERT_CONTEXT, # CERT_CONTEXT** optional, out
pdwSignerIndex: ptr uint32 # DWORD* optional, in/out
): int32 {.importc: "CryptMsgGetAndVerifySigner", stdcall, dynlib: "CRYPT32.dll".}pragma(lib, "crypt32");
extern(Windows)
int CryptMsgGetAndVerifySigner(
void* hCryptMsg, // void*
uint cSignerStore, // DWORD
void* rghSignerStore, // HCERTSTORE* optional
uint dwFlags, // DWORD
CERT_CONTEXT** ppSigner, // CERT_CONTEXT** optional, out
uint* pdwSignerIndex // DWORD* optional, in/out
);ccall((:CryptMsgGetAndVerifySigner, "CRYPT32.dll"), stdcall, Int32,
(Ptr{Cvoid}, UInt32, Ptr{Cvoid}, UInt32, Ptr{CERT_CONTEXT}, Ptr{UInt32}),
hCryptMsg, cSignerStore, rghSignerStore, dwFlags, ppSigner, pdwSignerIndex)
# hCryptMsg : void* -> Ptr{Cvoid}
# cSignerStore : DWORD -> UInt32
# rghSignerStore : HCERTSTORE* optional -> Ptr{Cvoid}
# dwFlags : DWORD -> UInt32
# ppSigner : CERT_CONTEXT** optional, out -> Ptr{CERT_CONTEXT}
# pdwSignerIndex : DWORD* optional, in/out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CryptMsgGetAndVerifySigner(
void* hCryptMsg,
uint32_t cSignerStore,
void* rghSignerStore,
uint32_t dwFlags,
void* ppSigner,
uint32_t* pdwSignerIndex);
]]
local crypt32 = ffi.load("crypt32")
-- crypt32.CryptMsgGetAndVerifySigner(hCryptMsg, cSignerStore, rghSignerStore, dwFlags, ppSigner, pdwSignerIndex)
-- hCryptMsg : void*
-- cSignerStore : DWORD
-- rghSignerStore : HCERTSTORE* optional
-- dwFlags : DWORD
-- ppSigner : CERT_CONTEXT** optional, out
-- pdwSignerIndex : DWORD* optional, in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('CRYPT32.dll');
const CryptMsgGetAndVerifySigner = lib.func('__stdcall', 'CryptMsgGetAndVerifySigner', 'int32_t', ['void *', 'uint32_t', 'void *', 'uint32_t', 'void *', 'uint32_t *']);
// CryptMsgGetAndVerifySigner(hCryptMsg, cSignerStore, rghSignerStore, dwFlags, ppSigner, pdwSignerIndex)
// hCryptMsg : void* -> 'void *'
// cSignerStore : DWORD -> 'uint32_t'
// rghSignerStore : HCERTSTORE* optional -> 'void *'
// dwFlags : DWORD -> 'uint32_t'
// ppSigner : CERT_CONTEXT** optional, out -> 'void *'
// pdwSignerIndex : DWORD* optional, in/out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("CRYPT32.dll", {
CryptMsgGetAndVerifySigner: { parameters: ["pointer", "u32", "pointer", "u32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.CryptMsgGetAndVerifySigner(hCryptMsg, cSignerStore, rghSignerStore, dwFlags, ppSigner, pdwSignerIndex)
// hCryptMsg : void* -> "pointer"
// cSignerStore : DWORD -> "u32"
// rghSignerStore : HCERTSTORE* optional -> "pointer"
// dwFlags : DWORD -> "u32"
// ppSigner : CERT_CONTEXT** optional, out -> "pointer"
// pdwSignerIndex : DWORD* optional, in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CryptMsgGetAndVerifySigner(
void* hCryptMsg,
uint32_t cSignerStore,
void* rghSignerStore,
uint32_t dwFlags,
void* ppSigner,
uint32_t* pdwSignerIndex);
C, "CRYPT32.dll");
// $ffi->CryptMsgGetAndVerifySigner(hCryptMsg, cSignerStore, rghSignerStore, dwFlags, ppSigner, pdwSignerIndex);
// hCryptMsg : void*
// cSignerStore : DWORD
// rghSignerStore : HCERTSTORE* optional
// dwFlags : DWORD
// ppSigner : CERT_CONTEXT** optional, out
// pdwSignerIndex : DWORD* optional, in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Crypt32 extends StdCallLibrary {
Crypt32 INSTANCE = Native.load("crypt32", Crypt32.class);
boolean CryptMsgGetAndVerifySigner(
Pointer hCryptMsg, // void*
int cSignerStore, // DWORD
Pointer rghSignerStore, // HCERTSTORE* optional
int dwFlags, // DWORD
Pointer ppSigner, // CERT_CONTEXT** optional, out
IntByReference pdwSignerIndex // DWORD* optional, in/out
);
}@[Link("crypt32")]
lib LibCRYPT32
fun CryptMsgGetAndVerifySigner = CryptMsgGetAndVerifySigner(
hCryptMsg : Void*, # void*
cSignerStore : UInt32, # DWORD
rghSignerStore : Void*, # HCERTSTORE* optional
dwFlags : UInt32, # DWORD
ppSigner : CERT_CONTEXT**, # CERT_CONTEXT** optional, out
pdwSignerIndex : UInt32* # DWORD* optional, in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CryptMsgGetAndVerifySignerNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Void>, Uint32, Pointer<Void>, Pointer<Uint32>);
typedef CryptMsgGetAndVerifySignerDart = int Function(Pointer<Void>, int, Pointer<Void>, int, Pointer<Void>, Pointer<Uint32>);
final CryptMsgGetAndVerifySigner = DynamicLibrary.open('CRYPT32.dll')
.lookupFunction<CryptMsgGetAndVerifySignerNative, CryptMsgGetAndVerifySignerDart>('CryptMsgGetAndVerifySigner');
// hCryptMsg : void* -> Pointer<Void>
// cSignerStore : DWORD -> Uint32
// rghSignerStore : HCERTSTORE* optional -> Pointer<Void>
// dwFlags : DWORD -> Uint32
// ppSigner : CERT_CONTEXT** optional, out -> Pointer<Void>
// pdwSignerIndex : DWORD* optional, in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CryptMsgGetAndVerifySigner(
hCryptMsg: Pointer; // void*
cSignerStore: DWORD; // DWORD
rghSignerStore: Pointer; // HCERTSTORE* optional
dwFlags: DWORD; // DWORD
ppSigner: Pointer; // CERT_CONTEXT** optional, out
pdwSignerIndex: Pointer // DWORD* optional, in/out
): BOOL; stdcall;
external 'CRYPT32.dll' name 'CryptMsgGetAndVerifySigner';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CryptMsgGetAndVerifySigner"
c_CryptMsgGetAndVerifySigner :: Ptr () -> Word32 -> Ptr () -> Word32 -> Ptr () -> Ptr Word32 -> IO CInt
-- hCryptMsg : void* -> Ptr ()
-- cSignerStore : DWORD -> Word32
-- rghSignerStore : HCERTSTORE* optional -> Ptr ()
-- dwFlags : DWORD -> Word32
-- ppSigner : CERT_CONTEXT** optional, out -> Ptr ()
-- pdwSignerIndex : DWORD* optional, in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let cryptmsggetandverifysigner =
foreign "CryptMsgGetAndVerifySigner"
((ptr void) @-> uint32_t @-> (ptr void) @-> uint32_t @-> (ptr void) @-> (ptr uint32_t) @-> returning int32_t)
(* hCryptMsg : void* -> (ptr void) *)
(* cSignerStore : DWORD -> uint32_t *)
(* rghSignerStore : HCERTSTORE* optional -> (ptr void) *)
(* dwFlags : DWORD -> uint32_t *)
(* ppSigner : CERT_CONTEXT** optional, out -> (ptr void) *)
(* pdwSignerIndex : DWORD* optional, in/out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library crypt32 (t "CRYPT32.dll"))
(cffi:use-foreign-library crypt32)
(cffi:defcfun ("CryptMsgGetAndVerifySigner" crypt-msg-get-and-verify-signer :convention :stdcall) :int32
(h-crypt-msg :pointer) ; void*
(c-signer-store :uint32) ; DWORD
(rgh-signer-store :pointer) ; HCERTSTORE* optional
(dw-flags :uint32) ; DWORD
(pp-signer :pointer) ; CERT_CONTEXT** optional, out
(pdw-signer-index :pointer)) ; DWORD* optional, in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CryptMsgGetAndVerifySigner = Win32::API::More->new('CRYPT32',
'BOOL CryptMsgGetAndVerifySigner(LPVOID hCryptMsg, DWORD cSignerStore, HANDLE rghSignerStore, DWORD dwFlags, LPVOID ppSigner, LPVOID pdwSignerIndex)');
# my $ret = $CryptMsgGetAndVerifySigner->Call($hCryptMsg, $cSignerStore, $rghSignerStore, $dwFlags, $ppSigner, $pdwSignerIndex);
# hCryptMsg : void* -> LPVOID
# cSignerStore : DWORD -> DWORD
# rghSignerStore : HCERTSTORE* optional -> HANDLE
# dwFlags : DWORD -> DWORD
# ppSigner : CERT_CONTEXT** optional, out -> LPVOID
# pdwSignerIndex : DWORD* optional, in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- s CTL_CONTEXT
- f CryptMsgControl — 暗号メッセージに対して各種制御操作を実行する。
- f CryptMsgOpenToDecode — デコード用の暗号メッセージを開く。
使用する型