internal static class CAUnmanaged
{
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_OpenDevice(ref System.IntPtr handle, string pszContainer, string pszProvider, int dwProvType, int dwFlags);
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_CloseDevice(System.IntPtr handle);
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_ReadCert(System.IntPtr handle, int dwCertNum, byte[] pbCert, ref int pcbCert);
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_EnvelopData(System.IntPtr handle, byte[] pbData, int cbData, int dwEncAlgId, byte[] pbRecipientInfo, int cbRecipientInfo, int dwSignAlgId, ref DATE_TIME signTime, int dwFlags, byte[] pbEnvelopedData, ref int pcbEnvelopedData);
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_VerifyEnvelopedData(System.IntPtr handle, byte[] pbEnvelopedData, int cbEnvelopedData, byte[] pbEncedData, int cbEncedData, byte[] pbCert, int cbCert, byte[] pbData, ref int pcbData);
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_SignData(System.IntPtr handle, byte[] pbData, int cbData, int dwSignAlgId, ref DATE_TIME signTime, int dwFlags, byte[] pbSignedData, ref int pcbSignedData);
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_VerifySignedData(System.IntPtr handle, byte[] pbSignedData, int cbSignedData, int dwFlags, byte[] pbData, int cbData, byte[] pbCert, int cbCert);
}
{
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_OpenDevice(ref System.IntPtr handle, string pszContainer, string pszProvider, int dwProvType, int dwFlags);
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_CloseDevice(System.IntPtr handle);
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_ReadCert(System.IntPtr handle, int dwCertNum, byte[] pbCert, ref int pcbCert);
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_EnvelopData(System.IntPtr handle, byte[] pbData, int cbData, int dwEncAlgId, byte[] pbRecipientInfo, int cbRecipientInfo, int dwSignAlgId, ref DATE_TIME signTime, int dwFlags, byte[] pbEnvelopedData, ref int pcbEnvelopedData);
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_VerifyEnvelopedData(System.IntPtr handle, byte[] pbEnvelopedData, int cbEnvelopedData, byte[] pbEncedData, int cbEncedData, byte[] pbCert, int cbCert, byte[] pbData, ref int pcbData);
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_SignData(System.IntPtr handle, byte[] pbData, int cbData, int dwSignAlgId, ref DATE_TIME signTime, int dwFlags, byte[] pbSignedData, ref int pcbSignedData);
[System.Runtime.InteropServices.DllImport("cryp_api.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int Crypt_VerifySignedData(System.IntPtr handle, byte[] pbSignedData, int cbSignedData, int dwFlags, byte[] pbData, int cbData, byte[] pbCert, int cbCert);
}
解决方案 »
- 如何控制(切换)其他程序的输入法
- 散分2
- 哪位兄弟帮忙解释下这个算法。。。。
- 得到ip的地名
- 在DELPHI中是否有读取I/O端口的函数?
- 新手提问: RxRichED怎么让其显示最新行位置?就是最底下...
- 刚找了一份工作,散分!
- 自学考试《数据库原理》顺利过关,也爽一爽,散分!:)
- 请问哪里有《Delphi 5.X ADO/MTS/COM+高级程序设计篇-李维著》随书光盘下载,谢谢了~~
- byrybye(BYRY):出来领分吧!(另外150分,等我验货后再给!放心,不会让你蚀的!)
- 有一个已经打开的Excel,怎么操作该进程里面的文件内容?
- Delphi7报错 No argument for format '%'
windows,Forms;var
hDll: THandle;
SetScreenParameter: procedure(nScreenNO, nWidth, nHeight, nScreenType: Integer; nMkType, nDataDA, nDataOE: Integer; nDataStyle, nDataSort, nFrequency: Integer; pFileName: pChar); stdcall;
SetScreenState: procedure(nScreenNO: Integer; bScreenState: Integer; pFileName: pChar); stdcall;procedure LoadDLL;implementationprocedure LoadDLL;
begin
hDll := LoadLibrary('TsDLL.dll');
if hDll < 32 then
begin
application.MessageBox('无法加载DLL文件!','错误',MB_OK+MB_ICONERROR);
exit; //如果Dll无法加载则跳出
end;
SetScreenParameter := GetProcAddress(hDll, 'SetScreenParameter');
SetScreenState := GetProcAddress(hDll, 'SetScreenState');
end;end.