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