⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cspkeytest.cpp

📁 PKCS#11 读取USB KEY证书
💻 CPP
字号:
#include "stdafx.h"

#include "SysKeyTest.h"
#include "DeriveKeyTest.h"
#include "RSA.h"

#define TEST_EXIT					0
#define RC2TESTCHOISE				1
#define RC4TESTCHOISE				2
#define DESTESTCHOISE				3
#define DERIVERC4KEYTESTCHOISE		4
#define DERIVEDESKEYTESTCHOISE		5
#define RSACHOISE					6
#define GETPROVPARAM				7

void ShowTitle(void)
{
	cout << endl;
	cout << "===========================================================" << endl;
	cout << "Please choise the test item:" << endl;
	cout << "   1: RC2 Geneartion/Encryption/Decryption Test" << endl;
	cout << "   2: RC4 Geneartion/Encryption/Decryption Test" << endl;
	cout << "   3: DES Geneartion/Encryption/Decryption Test" << endl;
	cout << "   4: RC4 Derive Key Test" << endl;
	cout << "   5: DES Derive Key Test" << endl;
	cout << "   6: RSA Keypair Geneartion/Encryption/Decryption Test" << endl << endl;
	cout << "   7: Show CSP Param" << endl << endl;
	cout << "   0: EXIT" << endl;
	cout << "===========================================================" << endl;
}

int main(void)
{
	for(;;)
	{
		ShowTitle();
		cout << "Input test item: ";
		char Choise[32] = {0};
		cin >> Choise;
		int iChoise = atoi(Choise);

		cout << endl << endl << "------------------------------------------------" << endl;

		switch(iChoise)
		{
		case RC2TESTCHOISE:
			{
				SysKeyTest test;
				cout << "RC2 test:" << endl;
				test.TestKey(TEST_RC2_ALG);
				cout << "RC2 test finish!" << endl;
			}
			break;

		case RC4TESTCHOISE:
			{
				SysKeyTest test;
				cout << "RC4 test:" << endl;
				test.TestKey(TEST_RC4_ALG);
				cout << "RC4 test finish!" << endl;
			}
			break;
		
		case DESTESTCHOISE:
			{
				SysKeyTest test;
				cout << "DES test:" << endl;
				test.TestKey(TEST_DES_ALG);
				cout << "Test DES key finish!" << endl;
			}
			break;
		
		case DERIVERC4KEYTESTCHOISE:
			{
				DeriveKeyTest derkeytest;
				cout << "Derive RC4 test:" << endl;
				derkeytest.Testkey(TEST_RC4_ALG);
				cout << "Test Derive RC4 key finish!" << endl;
			}
			break;

		case DERIVEDESKEYTESTCHOISE:
			{
				DeriveKeyTest derkeytest;
				cout << "Derive DES test:" << endl;
				derkeytest.Testkey(TEST_DES_ALG);
				cout << "Test derive des key finish!" << endl;
			}
			break;

		case RSACHOISE:
			{
				CRSA rsaTest;
				cout << "RSA test:" << endl;
				rsaTest.TestRSA();
				cout << "Test RSA key pair finish!" << endl;
			}
			break;

		case GETPROVPARAM:
			cout << "Get CSP Parameters:" << endl;
			GetProvParam();
			cout << "Get CSP Parameters finish!" << endl;
			break;

		case TEST_EXIT:
			//cout << "Press any key to exit..." << endl;
			return 0;
		}

		cout << endl;
	}

	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -