os/security/crypto/weakcrypto/test/tasymmetric/trsavector.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* Vector tests for RSA ciphers
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
#ifndef __TRSAVECTOR_H__
sl@0
    21
#define __TRSAVECTOR_H__
sl@0
    22
sl@0
    23
#include "tvectortest.h"
sl@0
    24
sl@0
    25
/**
sl@0
    26
 * Runs RSA encryption vectors.
sl@0
    27
 */
sl@0
    28
sl@0
    29
class CRSAEncryptVector : public CVectorTest
sl@0
    30
    {
sl@0
    31
public:
sl@0
    32
	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
sl@0
    33
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
    34
	static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
sl@0
    35
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
    36
	virtual ~CRSAEncryptVector();
sl@0
    37
protected:
sl@0
    38
	virtual void DoPerformActionL();
sl@0
    39
	virtual void DoPerformanceTestActionL();
sl@0
    40
private:
sl@0
    41
	CRSAEncryptVector(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
    42
	void ConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
    43
sl@0
    44
	CRSAPublicKey* iPubKey;
sl@0
    45
	HBufC8* iPlaintext;
sl@0
    46
	HBufC8* iCiphertext;
sl@0
    47
    };
sl@0
    48
sl@0
    49
/**
sl@0
    50
 * Runs RSA decryption vectors.
sl@0
    51
 */
sl@0
    52
sl@0
    53
class CRSADecryptVector : public CVectorTest
sl@0
    54
    {
sl@0
    55
public:
sl@0
    56
	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
sl@0
    57
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
    58
	static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
sl@0
    59
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
    60
	virtual ~CRSADecryptVector();
sl@0
    61
protected:
sl@0
    62
	virtual void DoPerformActionL();
sl@0
    63
	virtual void DoPerformanceTestActionL();
sl@0
    64
private:
sl@0
    65
	CRSADecryptVector(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
    66
	void ConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
    67
sl@0
    68
	CRSAPrivateKey* iPrivKey;    
sl@0
    69
	HBufC8* iCiphertext;
sl@0
    70
	HBufC8* iPlaintext;
sl@0
    71
    };
sl@0
    72
sl@0
    73
sl@0
    74
sl@0
    75
/**
sl@0
    76
 * Runs RSA decryption vectors.
sl@0
    77
 */
sl@0
    78
sl@0
    79
class CRSADecryptVectorCRT : public CVectorTest
sl@0
    80
    {
sl@0
    81
public:
sl@0
    82
	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
sl@0
    83
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
    84
	static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
sl@0
    85
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
    86
	virtual ~CRSADecryptVectorCRT();
sl@0
    87
protected:
sl@0
    88
	virtual void DoPerformActionL();
sl@0
    89
	virtual void DoPerformanceTestActionL();
sl@0
    90
private:
sl@0
    91
	CRSADecryptVectorCRT(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
    92
	void ConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
    93
private:
sl@0
    94
	CRSAPrivateKey* iPrivKey;    
sl@0
    95
	HBufC8* iCiphertext;
sl@0
    96
	HBufC8* iPlaintext;
sl@0
    97
    };
sl@0
    98
sl@0
    99
/**
sl@0
   100
 * Runs RSA signing vectors.
sl@0
   101
 */
sl@0
   102
sl@0
   103
class CRSASignVector : public CVectorTest
sl@0
   104
    {
sl@0
   105
public:
sl@0
   106
	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
sl@0
   107
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
   108
	static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
sl@0
   109
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
   110
	virtual ~CRSASignVector();
sl@0
   111
protected:
sl@0
   112
	virtual void DoPerformActionL();
sl@0
   113
	virtual void DoPerformanceTestActionL();
sl@0
   114
private:
sl@0
   115
	CRSASignVector(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
   116
	void ConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
   117
sl@0
   118
	CRSAPrivateKey* iPrivKey;
sl@0
   119
	HBufC8* iDigestInfo;
sl@0
   120
	CRSASignature* iSignature;
sl@0
   121
    };
sl@0
   122
sl@0
   123
class CRSASignVectorCRT : public CVectorTest
sl@0
   124
    {
sl@0
   125
public:
sl@0
   126
	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
sl@0
   127
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
   128
	static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
sl@0
   129
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
   130
	virtual ~CRSASignVectorCRT();
sl@0
   131
protected:
sl@0
   132
	virtual void DoPerformActionL();
sl@0
   133
	virtual void DoPerformanceTestActionL();
sl@0
   134
private:
sl@0
   135
	CRSASignVectorCRT(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
   136
	void ConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
   137
sl@0
   138
	CRSAPrivateKey* iPrivKey;
sl@0
   139
	HBufC8* iDigestInfo;
sl@0
   140
	CRSASignature* iSignature;
sl@0
   141
    };
sl@0
   142
/**
sl@0
   143
 * Runs RSA verification vectors.
sl@0
   144
 */
sl@0
   145
sl@0
   146
class CRSAVerifyVector : public CVectorTest
sl@0
   147
    {
sl@0
   148
public:
sl@0
   149
	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
sl@0
   150
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
   151
	static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
sl@0
   152
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
   153
	virtual ~CRSAVerifyVector();
sl@0
   154
protected:
sl@0
   155
	virtual void DoPerformActionL();
sl@0
   156
	virtual void DoPerformanceTestActionL();
sl@0
   157
private:
sl@0
   158
	CRSAVerifyVector(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
sl@0
   159
	void ConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
   160
sl@0
   161
	CRSAPublicKey* iPubKey;    
sl@0
   162
	HBufC8* iDigestInfo;
sl@0
   163
	CRSASignature* iSignature;
sl@0
   164
    };
sl@0
   165
sl@0
   166
#endif