From 06fccc6d7a8beb01253b9ffe25c4675121546555 Mon Sep 17 00:00:00 2001 From: dahall Date: Sat, 16 Jul 2022 16:05:05 -0600 Subject: [PATCH] Added CMSG_SIGNER_INFO --- PInvoke/Cryptography/Crypt32/Wincrypt.Msg.cs | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/PInvoke/Cryptography/Crypt32/Wincrypt.Msg.cs b/PInvoke/Cryptography/Crypt32/Wincrypt.Msg.cs index 4af73089..0c93c5a3 100644 --- a/PInvoke/Cryptography/Crypt32/Wincrypt.Msg.cs +++ b/PInvoke/Cryptography/Crypt32/Wincrypt.Msg.cs @@ -4790,6 +4790,46 @@ namespace Vanara.PInvoke public IntPtr pvHashEncryptionAuxInfo; } + /// + /// The CMSG_SIGNER_INFO structure contains the content of the PKCS #7 defined SignerInfo in signed messages. In decoding a + /// received message, CryptMsgGetParam is called for each signer to get a CMSG_SIGNER_INFO structure. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/ns-wincrypt-cmsg_signer_info typedef struct _CMSG_SIGNER_INFO { DWORD + // dwVersion; CERT_NAME_BLOB Issuer; CRYPT_INTEGER_BLOB SerialNumber; CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm; + // CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm; CRYPT_DATA_BLOB EncryptedHash; CRYPT_ATTRIBUTES AuthAttrs; CRYPT_ATTRIBUTES + // UnauthAttrs; } CMSG_SIGNER_INFO, *PCMSG_SIGNER_INFO; + [PInvokeData("wincrypt.h", MSDNShortId = "NS:wincrypt._CMSG_SIGNER_INFO")] + [StructLayout(LayoutKind.Sequential)] + public struct CMSG_SIGNER_INFO + { + /// The version of this structure. + public uint dwVersion; + + /// A CERT_NAME_BLOB structure that contains the issuer of a certificate with the public key needed to verify a signature. + public CRYPTOAPI_BLOB Issuer; + + /// + /// A CRYPT_INTEGER_BLOB structure that contains the serial number of the certificate that contains the public key needed to + /// verify a signature. For more information, see CERT_INFO. + /// + public CRYPTOAPI_BLOB SerialNumber; + + /// CRYPT_ALGORITHM_IDENTIFIER structure specifying the algorithm used in generating the hash of a message. + public CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm; + + /// CRYPT_ALGORITHM_IDENTIFIER structure specifying the algorithm used to encrypt the hash. + public CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm; + + /// A CRYPT_DATA_BLOB that contains the encrypted hash of the message, the signature. + public CRYPTOAPI_BLOB EncryptedHash; + + /// CRYPT_ATTRIBUTES structure containing authenticated attributes of the signer. + public CRYPT_ATTRIBUTES AuthAttrs; + + /// CRYPT_ATTRIBUTES structure containing unauthenticated attributes of the signer. + public CRYPT_ATTRIBUTES UnauthAttrs; + } + /// /// /// The CMSG_STREAM_INFO structure is used to enable stream processing of data rather than single block processing. Stream