os/security/crypto/weakcrypto/test/tasymmetric/tvectorutils.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 1998-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 *
    16 */
    17 
    18 
    19 #ifndef __TVECTORUTILS_H__
    20 #define __TVECTORUTILS_H__
    21 
    22 #include <e32std.h>
    23 #include "asymmetrickeys.h"
    24 #include "asymmetric.h"
    25 #include "bigint.h"
    26 
    27 /**
    28  * Defines static utility methods used by the vector tests.
    29  */
    30 
    31 class VectorUtils
    32     {
    33 public:
    34 
    35     /** Parse a hex string and return a new RInteger. */
    36     static RInteger ParseIntegerL(const TDesC8& aDes);
    37 
    38     /** Parse a hex string and return a new descriptor containing the binary data. */
    39 	static HBufC8* ParseBinaryL(const TDesC8& aDes);
    40 
    41     /** Return a new descriptor containing the hex representation of an Integer. */
    42 	static TDesC* PrintIntegerL(const TInteger& aInt);
    43 
    44     /** Return a new descriptor containing the hex representation of a binary string. */
    45 	static TDesC* PrintBinaryL(const TDesC8& aData);
    46 
    47     /** Parse a string containg either "ETrue" or "EFalse" and return a TBool. */
    48     static TBool ParseBoolL(const TDesC8& aDes);
    49 
    50     /** Create an RSA public key from from action data. */
    51     static CRSAPublicKey* ReadRSAPublicKeyL(const TDesC8& aData);
    52 
    53     /** Create an RSA private key from from action data. */
    54     static CRSAPrivateKeyStandard* ReadRSAPrivateKeyL(const TDesC8& aData);
    55 
    56 	/** Create an RSA private key from by CRT */
    57 	static CRSAPrivateKeyCRT* ReadRSAPrivateKeyCRTL(const TDesC8& aData);
    58 
    59     /** Create a DSA public key from from action data. */
    60     static CDSAPublicKey* ReadDSAPublicKeyL(const TDesC8& aData);
    61 
    62     /** Create a DSA private key from from action data. */
    63     static CDSAPrivateKey* ReadDSAPrivateKeyL(const TDesC8& aData);    
    64 
    65     /** Create a DSA signature from from action data. */
    66 	static CDSASignature* ReadDSASignatureL(const TDesC8& aData);
    67     };
    68 
    69 #endif