testdialogdlg.h
来自「how to use MSCSP encrypt and decrypt」· C头文件 代码 · 共 88 行
H
88 行
// TestDialogDlg.h : header file
//
#if !defined(AFX_TESTDIALOGDLG_H__68F57EEC_6BA6_4581_86EC_946B9170D6A4__INCLUDED_)
#define AFX_TESTDIALOGDLG_H__68F57EEC_6BA6_4581_86EC_946B9170D6A4__INCLUDED_
#define _WIN32_WINNT 0x0500 // to make the HCRYPT.. valid
#include <Wincrypt.h>
#define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
#define KEYLENGTH 0x00800000
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CTestDialogDlg dialog
class CTestDialogDlg : public CDialog
{
// Construction
public:
BYTE* GetVarifySignatureData(HCRYPTHASH hHash, HCRYPTKEY hPubKey, CString strSignatedData);
BYTE* GetSignatureData(HCRYPTHASH hHash);
HCRYPTHASH AddDataToHash(HCRYPTPROV hProv, CString strSignatureData);
void ExportPublicKey(HCRYPTKEY hKey);
HCRYPTKEY ImportPublicKey(HCRYPTPROV hProv, BYTE* pbKeyBlob, DWORD dwBlobLen);
HCRYPTKEY GetKeyFromContainer(HCRYPTPROV);
BYTE* DecryptData(HCRYPTKEY hKey, CString strDecryptingData);
BYTE* EncryptData(HCRYPTKEY hKey, CString strEncrypting);
HCRYPTKEY CreateSessionKey(CString strPassword, UINT AlgID, DWORD dwFlag);
HCRYPTPROV InitCryptProv(CString strCSPName, DWORD dwCSPType=PROV_RSA_FULL, DWORD dwFlags=0);
void EnableControls(UINT uArray[], UINT uSize, BOOL blEnable);
void EnableScreen(BOOL blEncrypt, BOOL blIsSymmetry);
CTestDialogDlg(CWnd* pParent = NULL); // standard constructor
~CTestDialogDlg(); // standard constructor
// Dialog Data
//{{AFX_DATA(CTestDialogDlg)
enum { IDD = IDD_TESTDIALOG_DIALOG };
CString m_strEncryptingData;
CString m_strDecryptingData;
CString m_strPassword;
CString m_strSignatingData;
CString m_strPublicKey;
CString m_strPrivateKey;
CString m_strSignatedData;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTestDialogDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CTestDialogDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnButton1();
afx_msg void OnButton2();
afx_msg void OnChangeEdit1();
afx_msg void OnChangeEdit3();
afx_msg void OnButton3();
afx_msg void OnButton4();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
HCRYPTPROV m_hCryptProv;
BYTE* m_pbKeyBlob;
DWORD m_dwKeyBlobLen;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_TESTDIALOGDLG_H__68F57EEC_6BA6_4581_86EC_946B9170D6A4__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?