1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/crypto/weakcryptospi/test/tasymmetric/trsavector.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,166 @@
1.4 +/*
1.5 +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* Vector tests for RSA ciphers
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +#ifndef __TRSAVECTOR_H__
1.24 +#define __TRSAVECTOR_H__
1.25 +
1.26 +#include "tvectortest.h"
1.27 +
1.28 +/**
1.29 + * Runs RSA encryption vectors.
1.30 + */
1.31 +
1.32 +class CRSAEncryptVector : public CVectorTest
1.33 + {
1.34 +public:
1.35 + static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
1.36 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.37 + static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
1.38 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.39 + virtual ~CRSAEncryptVector();
1.40 +protected:
1.41 + virtual void DoPerformActionL();
1.42 + virtual void DoPerformanceTestActionL();
1.43 +private:
1.44 + CRSAEncryptVector(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
1.45 + void ConstructL(const TTestActionSpec& aTestActionSpec);
1.46 +
1.47 + CRSAPublicKey* iPubKey;
1.48 + HBufC8* iPlaintext;
1.49 + HBufC8* iCiphertext;
1.50 + };
1.51 +
1.52 +/**
1.53 + * Runs RSA decryption vectors.
1.54 + */
1.55 +
1.56 +class CRSADecryptVector : public CVectorTest
1.57 + {
1.58 +public:
1.59 + static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
1.60 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.61 + static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
1.62 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.63 + virtual ~CRSADecryptVector();
1.64 +protected:
1.65 + virtual void DoPerformActionL();
1.66 + virtual void DoPerformanceTestActionL();
1.67 +private:
1.68 + CRSADecryptVector(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
1.69 + void ConstructL(const TTestActionSpec& aTestActionSpec);
1.70 +
1.71 + CRSAPrivateKey* iPrivKey;
1.72 + HBufC8* iCiphertext;
1.73 + HBufC8* iPlaintext;
1.74 + };
1.75 +
1.76 +
1.77 +
1.78 +/**
1.79 + * Runs RSA decryption vectors.
1.80 + */
1.81 +
1.82 +class CRSADecryptVectorCRT : public CVectorTest
1.83 + {
1.84 +public:
1.85 + static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
1.86 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.87 + static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
1.88 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.89 + virtual ~CRSADecryptVectorCRT();
1.90 +protected:
1.91 + virtual void DoPerformActionL();
1.92 + virtual void DoPerformanceTestActionL();
1.93 +private:
1.94 + CRSADecryptVectorCRT(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
1.95 + void ConstructL(const TTestActionSpec& aTestActionSpec);
1.96 +private:
1.97 + CRSAPrivateKey* iPrivKey;
1.98 + HBufC8* iCiphertext;
1.99 + HBufC8* iPlaintext;
1.100 + };
1.101 +
1.102 +/**
1.103 + * Runs RSA signing vectors.
1.104 + */
1.105 +
1.106 +class CRSASignVector : public CVectorTest
1.107 + {
1.108 +public:
1.109 + static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
1.110 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.111 + static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
1.112 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.113 + virtual ~CRSASignVector();
1.114 +protected:
1.115 + virtual void DoPerformActionL();
1.116 + virtual void DoPerformanceTestActionL();
1.117 +private:
1.118 + CRSASignVector(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
1.119 + void ConstructL(const TTestActionSpec& aTestActionSpec);
1.120 +
1.121 + CRSAPrivateKey* iPrivKey;
1.122 + HBufC8* iDigestInfo;
1.123 + CRSASignature* iSignature;
1.124 + };
1.125 +
1.126 +class CRSASignVectorCRT : public CVectorTest
1.127 + {
1.128 +public:
1.129 + static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
1.130 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.131 + static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
1.132 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.133 + virtual ~CRSASignVectorCRT();
1.134 +protected:
1.135 + virtual void DoPerformActionL();
1.136 + virtual void DoPerformanceTestActionL();
1.137 +private:
1.138 + CRSASignVectorCRT(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
1.139 + void ConstructL(const TTestActionSpec& aTestActionSpec);
1.140 +
1.141 + CRSAPrivateKey* iPrivKey;
1.142 + HBufC8* iDigestInfo;
1.143 + CRSASignature* iSignature;
1.144 + };
1.145 +/**
1.146 + * Runs RSA verification vectors.
1.147 + */
1.148 +
1.149 +class CRSAVerifyVector : public CVectorTest
1.150 + {
1.151 +public:
1.152 + static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
1.153 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.154 + static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
1.155 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.156 + virtual ~CRSAVerifyVector();
1.157 +protected:
1.158 + virtual void DoPerformActionL();
1.159 + virtual void DoPerformanceTestActionL();
1.160 +private:
1.161 + CRSAVerifyVector(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
1.162 + void ConstructL(const TTestActionSpec& aTestActionSpec);
1.163 +
1.164 + CRSAPublicKey* iPubKey;
1.165 + HBufC8* iDigestInfo;
1.166 + CRSASignature* iSignature;
1.167 + };
1.168 +
1.169 +#endif