100 references to Crypt32
System.Security.Cryptography.Pkcs (100)
_generated\0\LibraryImports.g.cs (56)
324internal static partial bool CertGetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, byte[] pvData, ref int pcbData) 360static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, byte* __pvData_native, int* __pcbData_native); 370internal static unsafe partial bool CertGetCertificateContextPropertyPtr(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, byte* pvData, ref int pcbData) 405static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, byte* __pvData_native, int* __pcbData_native); 415internal static partial bool CertGetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, out nint pvData, ref int pcbData) 452static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, nint* __pvData_native, int* __pcbData_native); 462internal static partial bool CertGetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, out global::Interop.Crypt32.DATA_BLOB pvData, ref int pcbData) 477fixed (global::Interop.Crypt32.DATA_BLOB* __pvData_native = &pvData) 499static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, global::Interop.Crypt32.DATA_BLOB* __pvData_native, int* __pcbData_native); 509internal static partial int CertGetPublicKeyLength(global::Interop.Crypt32.MsgEncodingType dwCertEncodingType, ref global::Interop.Crypt32.CERT_PUBLIC_KEY_INFO pPublicKey) 514fixed (global::Interop.Crypt32.CERT_PUBLIC_KEY_INFO* __pPublicKey_native = &pPublicKey) 525static extern unsafe int __PInvoke(global::Interop.Crypt32.MsgEncodingType __dwCertEncodingType_native, global::Interop.Crypt32.CERT_PUBLIC_KEY_INFO* __pPublicKey_native); 559internal static partial bool CryptAcquireCertificatePrivateKey(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCert, global::Interop.Crypt32.CryptAcquireCertificatePrivateKeyFlags dwFlags, nint pvParameters, out nint phCryptProvOrNCryptKey, out global::Interop.Crypt32.CryptKeySpec pdwKeySpec, out bool pfCallerFreeProvOrNCryptKey) 576fixed (global::Interop.Crypt32.CryptKeySpec* __pdwKeySpec_native = &pdwKeySpec) 600static extern unsafe int __PInvoke(nint __pCert_native, global::Interop.Crypt32.CryptAcquireCertificatePrivateKeyFlags __dwFlags_native, nint __pvParameters_native, nint* __phCryptProvOrNCryptKey_native, global::Interop.Crypt32.CryptKeySpec* __pdwKeySpec_native, int* __pfCallerFreeProvOrNCryptKey_native); 610private static unsafe partial bool CryptDecodeObject(global::Interop.Crypt32.MsgEncodingType dwCertEncodingType, nint lpszStructType, nint pbEncoded, int cbEncoded, int dwFlags, void* pvStructInfo, ref int pcbStructInfo) 629static extern unsafe int __PInvoke(global::Interop.Crypt32.MsgEncodingType __dwCertEncodingType_native, nint __lpszStructType_native, nint __pbEncoded_native, int __cbEncoded_native, int __dwFlags_native, void* __pvStructInfo_native, int* __pcbStructInfo_native); 639private static unsafe partial bool CryptEncodeObject(global::Interop.Crypt32.MsgEncodingType dwCertEncodingType, nint lpszStructType, void* pvStructInfo, byte[] pbEncoded, ref int pcbEncoded) 659static extern unsafe int __PInvoke(global::Interop.Crypt32.MsgEncodingType __dwCertEncodingType_native, nint __lpszStructType_native, void* __pvStructInfo_native, byte* __pbEncoded_native, int* __pcbEncoded_native); 696internal static partial bool CryptMsgControl(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, int dwFlags, global::Interop.Crypt32.MsgControlType dwCtrlType, ref global::Interop.Crypt32.CMSG_CTRL_DECRYPT_PARA pvCtrlPara) 709fixed (global::Interop.Crypt32.CMSG_CTRL_DECRYPT_PARA* __pvCtrlPara_native = &pvCtrlPara) 731static extern unsafe int __PInvoke(nint __hCryptMsg_native, int __dwFlags_native, global::Interop.Crypt32.MsgControlType __dwCtrlType_native, global::Interop.Crypt32.CMSG_CTRL_DECRYPT_PARA* __pvCtrlPara_native); 741internal static partial bool CryptMsgControl(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, int dwFlags, global::Interop.Crypt32.MsgControlType dwCtrlType, ref global::Interop.Crypt32.CMSG_CTRL_KEY_AGREE_DECRYPT_PARA pvCtrlPara) 754fixed (global::Interop.Crypt32.CMSG_CTRL_KEY_AGREE_DECRYPT_PARA* __pvCtrlPara_native = &pvCtrlPara) 776static extern unsafe int __PInvoke(nint __hCryptMsg_native, int __dwFlags_native, global::Interop.Crypt32.MsgControlType __dwCtrlType_native, global::Interop.Crypt32.CMSG_CTRL_KEY_AGREE_DECRYPT_PARA* __pvCtrlPara_native); 786internal static partial bool CryptMsgGetParam(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, global::Interop.Crypt32.CryptMsgParamType dwParamType, int dwIndex, out int pvData, ref int pcbData) 823static extern unsafe int __PInvoke(nint __hCryptMsg_native, global::Interop.Crypt32.CryptMsgParamType __dwParamType_native, int __dwIndex_native, int* __pvData_native, int* __pcbData_native); 833internal static unsafe partial bool CryptMsgGetParam(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, global::Interop.Crypt32.CryptMsgParamType dwParamType, int dwIndex, byte* pvData, ref int pcbData) 868static extern unsafe int __PInvoke(nint __hCryptMsg_native, global::Interop.Crypt32.CryptMsgParamType __dwParamType_native, int __dwIndex_native, byte* __pvData_native, int* __pcbData_native); 878internal static partial bool CryptMsgGetParam(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, global::Interop.Crypt32.CryptMsgParamType dwParamType, int dwIndex, out global::Interop.Crypt32.CryptMsgType pvData, ref int pcbData) 893fixed (global::Interop.Crypt32.CryptMsgType* __pvData_native = &pvData) 915static extern unsafe int __PInvoke(nint __hCryptMsg_native, global::Interop.Crypt32.CryptMsgParamType __dwParamType_native, int __dwIndex_native, global::Interop.Crypt32.CryptMsgType* __pvData_native, int* __pcbData_native); 925internal static partial bool CryptMsgGetParam(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, global::Interop.Crypt32.CryptMsgParamType dwParamType, int dwIndex, nint pvData, ref int pcbData) 960static extern unsafe int __PInvoke(nint __hCryptMsg_native, global::Interop.Crypt32.CryptMsgParamType __dwParamType_native, int __dwIndex_native, nint __pvData_native, int* __pcbData_native); 970internal static partial global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle CryptMsgOpenToDecode(global::Interop.Crypt32.MsgEncodingType dwMsgEncodingType, int dwFlags, int dwMsgType, nint hCryptProv, nint pRecipientInfo, nint pStreamInfo) 1005static extern unsafe nint __PInvoke(global::Interop.Crypt32.MsgEncodingType __dwMsgEncodingType_native, int __dwFlags_native, int __dwMsgType_native, nint __hCryptProv_native, nint __pRecipientInfo_native, nint __pStreamInfo_native); 1015internal static unsafe partial global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle CryptMsgOpenToEncode(global::Interop.Crypt32.MsgEncodingType dwMsgEncodingType, int dwFlags, global::Interop.Crypt32.CryptMsgType dwMsgType, global::Interop.Crypt32.CMSG_ENVELOPED_ENCODE_INFO* pvMsgEncodeInfo, string pszInnerContentObjID, nint pStreamInfo) 1059static extern unsafe nint __PInvoke(global::Interop.Crypt32.MsgEncodingType __dwMsgEncodingType_native, int __dwFlags_native, global::Interop.Crypt32.CryptMsgType __dwMsgType_native, global::Interop.Crypt32.CMSG_ENVELOPED_ENCODE_INFO* __pvMsgEncodeInfo_native, byte* __pszInnerContentObjID_native, nint __pStreamInfo_native); 1207private static unsafe extern partial global::Interop.Crypt32.CRYPT_OID_INFO* CryptFindOIDInfo(global::Interop.Crypt32.CryptOidInfoKeyType dwKeyType, nint pvKey, global::System.Security.Cryptography.OidGroup group);
Internal\Cryptography\Pal\Windows\DecryptorPalWindows.Decode.cs (3)
13using static Interop.Crypt32; 31hCryptMsg = Interop.Crypt32.CryptMsgOpenToDecode(MsgEncodingType.All, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); 35if (!Interop.Crypt32.CryptMsgUpdate(
Internal\Cryptography\Pal\Windows\DecryptorPalWindows.DecodeRecipients.cs (2)
11using static Interop.Crypt32; 21if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, CryptMsgParamType.CMSG_CMS_RECIPIENT_COUNT_PARAM, 0, out numRecipients, ref cbRecipientsCount))
Internal\Cryptography\Pal\Windows\DecryptorPalWindows.Decrypt.cs (6)
13using static Interop.Crypt32; 128if (Interop.Crypt32.CertGetCertificateContextProperty( 138if (!Interop.Crypt32.CertGetCertificateContextProperty(hCertContext, CertContextPropId.CERT_KEY_PROV_INFO_PROP_ID, null, ref cbSize)) 150if (!Interop.Crypt32.CertGetCertificateContextProperty(hCertContext, CertContextPropId.CERT_KEY_PROV_INFO_PROP_ID, pData, ref cbSize)) 180bool success = Interop.Crypt32.CryptMsgControl(_hCryptMsg, 0, MsgControlType.CMSG_CTRL_DECRYPT, ref decryptPara); 262if (!Interop.Crypt32.CryptMsgControl(_hCryptMsg, 0, MsgControlType.CMSG_CTRL_KEY_AGREE_DECRYPT, ref decryptPara))
Internal\Cryptography\Pal\Windows\HelpersWindows.cs (18)
14using static Interop.Crypt32; 36if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, paramType, index, IntPtr.Zero, ref cbData)) 42if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, paramType, index, pvData, ref cbData)) 53if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, paramType, index, IntPtr.Zero, ref cbData)) 59if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, paramType, index, pvData.DangerousGetHandle(), ref cbData)) 84if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, CryptMsgParamType.CMSG_TYPE_PARAM, 0, out cryptMsgType, ref cbData)) 93if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, CryptMsgParamType.CMSG_VERSION_PARAM, 0, out version, ref cbData)) 128if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, CryptMsgParamType.CMSG_CERT_COUNT_PARAM, 0, out numCertificates, ref cbNumCertificates)) 145CRYPT_OID_INFO info = Interop.Crypt32.FindOidInfo(CryptOidInfoKeyType.CRYPT_OID_INFO_OID_KEY, oidValue, OidGroup.All, false); 152pCertContext = Interop.Crypt32.CertDuplicateCertificateContext(pCertContext); 161if (!Interop.Crypt32.CertGetCertificateContextProperty(hCertContext, CertContextPropId.CERT_KEY_IDENTIFIER_PROP_ID, null, ref cbData)) 165if (!Interop.Crypt32.CertGetCertificateContextProperty(hCertContext, CertContextPropId.CERT_KEY_IDENTIFIER_PROP_ID, ski, ref cbData)) 184int nc = Interop.Crypt32.CertNameToStr((int)MsgEncodingType.All, dataBlobPtr, dwStrType, null, 0); 193nc = Interop.Crypt32.CertNameToStr((int)MsgEncodingType.All, dataBlobPtr, dwStrType, namePtr, nc); 243int keyLength = Interop.Crypt32.CertGetPublicKeyLength(MsgEncodingType.All, ref publicKeyInfo); 272if (!Interop.Crypt32.CryptDecodeObject(CryptDecodeObjectStructType.PKCS_RC2_CBC_PARAMETERS, cryptAlgorithmIdentifier.Parameters.pbData, (int)(cryptAlgorithmIdentifier.Parameters.cbData), &rc2Parameters, ref cbSize)) 293using (SafeHandle sh = Interop.Crypt32.CryptDecodeObjectToMemory(CryptDecodeObjectStructType.X509_OCTET_STRING, cryptAlgorithmIdentifier.Parameters.pbData, (int)cryptAlgorithmIdentifier.Parameters.cbData)) 340if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, CryptMsgParamType.CMSG_UNPROTECTED_ATTR_PARAM, 0, IntPtr.Zero, ref cbUnprotectedAttr))
Internal\Cryptography\Pal\Windows\KeyAgreeRecipientInfoPalWindows.cs (1)
10using static Interop.Crypt32;
Internal\Cryptography\Pal\Windows\KeyTransRecipientInfoPalWindows.cs (1)
11using static Interop.Crypt32;
Internal\Cryptography\Pal\Windows\PkcsPalWindows.cs (6)
14using static Interop.Crypt32; 31using (SafeCryptMsgHandle hCryptMsg = Interop.Crypt32.CryptMsgOpenToDecode(MsgEncodingType.All, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero)) 36if (!Interop.Crypt32.CryptMsgUpdate(hCryptMsg, ref MemoryMarshal.GetReference(encodedMessage), encodedMessage.Length, fFinal: true)) 41if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, CryptMsgParamType.CMSG_TYPE_PARAM, 0, out msgTypeAsInt, ref cbSize)) 222if (Interop.Crypt32.CertGetCertificateContextProperty( 233if (!Interop.Crypt32.CryptAcquireCertificatePrivateKey(
Internal\Cryptography\Pal\Windows\PkcsPalWindows.Encrypt.cs (4)
12using static Interop.Crypt32; 47if (!Interop.Crypt32.CryptMsgUpdate(hCryptMsg, encodedContent, encodedContent.Length, fFinal: true)) 120SafeCryptMsgHandle hCryptMsg = Interop.Crypt32.CryptMsgOpenToEncode(MsgEncodingType.All, 0, CryptMsgType.CMSG_ENVELOPED, pEnvelopedEncodeInfo, innerContentType.Value!, IntPtr.Zero); 381pEncryptedKey->Date = default(Interop.Crypt32.FILETIME);
Microsoft\Win32\SafeHandles\SafeCertContextHandle.cs (2)
8using static Interop.Crypt32; 31Interop.Crypt32.CertFreeCertificateContext(handle); // CertFreeCertificateContext always returns TRUE so no point in checking.
Microsoft\Win32\SafeHandles\SafeCryptMsgHandle.cs (1)
24bool success = Interop.Crypt32.CryptMsgClose(handle);