os/security/crypto/weakcryptospi/test/tcryptospi/src/te_cryptospiconversion.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/crypto/weakcryptospi/test/tcryptospi/src/te_cryptospiconversion.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,416 @@
     1.4 +/*
     1.5 +* Copyright (c) 2007-2010 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 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file
    1.24 + @internalTechnology
    1.25 +*/
    1.26 +
    1.27 +#include "te_cryptospiconversion.h"
    1.28 +#include "te_cryptospidefs.h"
    1.29 +#include <cryptospi/cryptohashapi.h>
    1.30 +#include <cryptospi/cryptorandomapi.h>
    1.31 +#include <cryptospi/cryptosymmetriccipherapi.h>
    1.32 +#include <cryptospi/cryptoasymmetriccipherapi.h>
    1.33 +#include <cryptospi/cryptosignatureapi.h>
    1.34 +#include <cryptospi/cryptokeypairgeneratorapi.h>
    1.35 +#include <cryptospi/cryptokeyagreementapi.h>
    1.36 +#include <cryptospi/ruleselector.h>
    1.37 +
    1.38 +using namespace CryptoSpi;
    1.39 +
    1.40 +//Returns the Uid representation for the stored string value
    1.41 +TVariantPtrC::operator TUid()
    1.42 +	{
    1.43 +	if (*this==_L("KAlgorithmHashMd2"))	return KMd2Uid;	
    1.44 +	else if (*this==_L("KAlgorithmHashMd5")) return KMd5Uid;
    1.45 +	else if (*this==_L("KAlgorithmHashSha1")) return KSha1Uid;
    1.46 +	else if (*this==_L("KAlgorithmHashMd4")) return KMd4Uid;
    1.47 +	else if (*this==_L("KAlgorithmHashSha224")) return KSha224Uid;
    1.48 +	else if (*this==_L("KAlgorithmHashSha256")) return KSha256Uid;
    1.49 +	else if (*this==_L("KAlgorithmHashSha384")) return KSha384Uid;
    1.50 +	else if (*this==_L("KAlgorithmHashSha512")) return KSha512Uid;
    1.51 +	else if (*this==_L("KAlgorithmRandom")) return KRandomUid;	
    1.52 +	else if (*this==_L("KAlgorithmCipherDes")) return KDesUid;	
    1.53 +	else if (*this==_L("KAlgorithmCipher3Des")) return K3DesUid;
    1.54 +	else if (*this==_L("KAlgorithmCipherRc2")) return KRc2Uid;
    1.55 +	else if (*this==_L("KAlgorithmCipherArc4")) return KArc4Uid;
    1.56 +	else if (*this==_L("KAlgorithmCipherAes")) return KAesUid;
    1.57 +	else if (*this==_L("KAlgorithmCipherMisty1")) return KMisty1Uid;
    1.58 +	else if (*this==_L("KAlgorithmCipherMisty2")) return KMisty2Uid;
    1.59 +	else if (*this==_L("KAlgorithmCipherKasumi")) return KKasumiUid;
    1.60 +	else if (*this==_L("KAlgorithmCipherRsa")) return KRsaCipherUid;
    1.61 +	else if (*this==_L("KAlgorithmSignerRsa")) return KRsaSignerUid;
    1.62 +	else if (*this==_L("KAlgorithmSignerDsa")) return KDsaSignerUid; 
    1.63 +	else if (*this==_L("KAlgorithmVerifierRsa")) return KRsaVerifierUid;
    1.64 +	else if (*this==_L("KAlgorithmVerifierDsa")) return KDsaVerifierUid;
    1.65 +	else if (*this==_L("KAlgorithmKeyAgreementDH")) return KDHAgreementUid;
    1.66 +	else if (*this==_L("KAlgorithmRSAKeyPairGenerator")) return KRSAKeyPairGeneratorUid;
    1.67 +	else if (*this==_L("KAlgorithmDSAKeyPairGenerator")) return KDSAKeyPairGeneratorUid;
    1.68 +	else if (*this==_L("KAlgorithmDHKeyPairGenerator")) return KDHKeyPairGeneratorUid;
    1.69 +
    1.70 +	else if (*this==_L("KHashInterface")) return KHashInterfaceUid;
    1.71 +	else if (*this==_L("KRandomInterface")) return KRandomInterfaceUid;
    1.72 +	else if (*this==_L("KSymmetricCipherInterface")) return KSymmetricCipherInterfaceUid;
    1.73 +	else if (*this==_L("KAsymmetricCipherInterface")) return KAsymmetricCipherInterfaceUid;
    1.74 +	else if (*this==_L("KSignerInterface")) return KSignerInterfaceUid;
    1.75 +	else if (*this==_L("KVerifierInterface")) return KVerifierInterfaceUid;
    1.76 +	else if (*this==_L("KKeyAgreementInterface")) return KKeyAgreementInterfaceUid;
    1.77 +	else if (*this==_L("KKeyGeneratorInterface")) return KKeyGeneratorInterfaceUid;
    1.78 +	else if (*this==_L("KKeypairGeneratorInterface")) return KKeypairGeneratorInterfaceUid;
    1.79 +	else if (*this==_L("KAsyncHashInterface")) return KAsyncHashInterfaceUid;
    1.80 +	else if (*this==_L("KAsyncRandomInterface")) return KAsyncRandomInterfaceUid;
    1.81 +	else if (*this==_L("KAsyncSymmetricCipherInterface")) return KAsyncSymmetricCipherInterfaceUid;
    1.82 +	else if (*this==_L("KAsyncAsymmetricCipherInterface")) return KAsyncAsymmetricCipherInterfaceUid;
    1.83 +	else if (*this==_L("KAsyncSignerInterface")) return KAsyncSignerInterfaceUid;
    1.84 +	else if (*this==_L("KAsyncVerifierInterface")) return KAsyncVerifierInterfaceUid;
    1.85 +	else if (*this==_L("KAsyncKeyAgreementInterface")) return KAsyncKeyAgreementInterfaceUid;
    1.86 +	else if (*this==_L("KAsyncKeyGeneratorInterface")) return KAsyncKeyGeneratorInterfaceUid;
    1.87 +	else if (*this==_L("KAsyncKeypairGeneratorInterface")) return KAsyncKeypairGeneratorInterfaceUid;
    1.88 +	
    1.89 +	else if (*this==_L("KCryptoModeEncrypt")) return KCryptoModeEncryptUid;
    1.90 +	else if (*this==_L("KCryptoModeDecrypt")) return KCryptoModeDecryptUid;
    1.91 +	
    1.92 +	else if (*this==_L("KOperationModeNone")) return KOperationModeNoneUid;	
    1.93 +	else if (*this==_L("KOperationModeECB")) return KOperationModeECBUid;
    1.94 +	else if (*this==_L("KOperationModeCBC")) return KOperationModeCBCUid;
    1.95 +	else if (*this==_L("KOperationModeOFB")) return KOperationModeOFBUid;
    1.96 +	else if (*this==_L("KOperationModeCFB")) return KOperationModeCFBUid;
    1.97 +	else if (*this==_L("KOperationModeCTR")) return KOperationModeCTRUid;
    1.98 +	else if (*this==_L("KHashMode")) return KHashModeUid;
    1.99 +	else if (*this==_L("KHmacMode")) return KHmacModeUid;
   1.100 +	
   1.101 +	else if (*this==_L("KPaddingInterface")) return KPaddingInterfaceUid;	
   1.102 +	else if (*this==_L("KPaddingModeNone")) return KPaddingModeNoneUid;
   1.103 +	else if (*this==_L("KPaddingModeSSLv3")) return KPaddingModeSSLv3Uid;
   1.104 +	else if (*this==_L("KPaddingModePKCS7")) return KPaddingModePKCS7Uid;
   1.105 +	else if (*this==_L("KPaddingModePkcs1_v1_5_Encryption")) return KPaddingModePkcs1_v1_5_EncryptionUid;
   1.106 +	else if (*this==_L("KPaddingModePkcs1_v1_5_Signature")) return KPaddingModePkcs1_v1_5_SignatureUid;
   1.107 +	
   1.108 +	else if (*this==_L("KSymmetricKey")) return	KSymmetricKeyUid;
   1.109 +	else if (*this==_L("KSymmetricKeyParameter")) return KSymmetricKeyParameterUid;
   1.110 +	else if (*this==_L("KRsaKeyParameterN")) return KRsaKeyParameterNUid;
   1.111 +	else if (*this==_L("KHmacKey")) return	KHmacKeyUid;
   1.112 +	else if (*this==_L("KHmacKeyParameter")) return KHmacKeyParameterUid;
   1.113 +			
   1.114 +	else if (*this==_L("KRsaSigner")) return KRsaSignerUid;
   1.115 +	else if (*this==_L("KDsaSigner")) return KDsaSignerUid;
   1.116 +	
   1.117 +	else if (*this==_L("KNone")) return KNoneUid;
   1.118 +	else if (*this==_L("KInterfaceType")) return KInterfaceTypeUid;
   1.119 +	else if (*this==_L("KAlgorithmType")) return KAlgorithmTypeUid;
   1.120 +	else if (*this==_L("KImplementationType")) return KImplementationTypeUid;
   1.121 +	else if (*this==_L("KCreatorNameType")) return KCreatorNameTypeUid;
   1.122 +	else if (*this==_L("KIsFIPSApprovedType")) return KIsFIPSApprovedTypeUid;
   1.123 +	else if (*this==_L("KIsHardwareSupportedType")) return KIsHardwareSupportedTypeUid;
   1.124 +	else if (*this==_L("KMaxConcurrencySupportedType")) return KMaxConcurrencySupportedTypeUid;
   1.125 +	else if (*this==_L("KLatencyType")) return KLatencyTypeUid;
   1.126 +	else if (*this==_L("KThroughputType")) return KThroughputTypeUid;
   1.127 +	else if (*this==_L("KBlockSizeType")) return KBlockSizeTypeUid;
   1.128 +	else if (*this==_L("KOutputSizeType")) return KOutputSizeTypeUid;
   1.129 +	else if (*this==_L("KSupportedOperationModesType")) return KSupportedOperationModesTypeUid;
   1.130 +	else if (*this==_L("KBlockingModeType")) return KBlockingModeTypeUid;
   1.131 +	else if (*this==_L("KMaximumKeyLengthType")) return KMaximumKeyLengthTypeUid;
   1.132 +	else if (*this==_L("KSupportedPaddingModesType")) return KSupportedPaddingModesTypeUid;
   1.133 +	else if (*this==_L("KKeySupportModeType")) return KKeySupportModeTypeUid;
   1.134 +	else if (*this==_L("KConcurrencyType")) return KConcurrencyTypeUid;
   1.135 +	else if (*this==_L("KExclusiveUseType")) return KExclusiveUseTypeUid;
   1.136 +	
   1.137 +	else if (*this==_L("KExtendCharType1")) return KExtendCharType1Uid;
   1.138 +	else if (*this==_L("KExtendCharType2")) return KExtendCharType2Uid;
   1.139 +	else if (*this==_L("KExtendCharType3")) return KExtendCharType3Uid;
   1.140 +#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
   1.141 +	else if (*this==_L("KAlgorithmCipherAesXcbcMac96")) return KAesXcbcMac96Uid;
   1.142 +	else if (*this==_L("KAlgorithmCipherAesXcbcPrf128")) return KAesXcbcPrf128Uid;
   1.143 +	else if (*this==_L("KMacInterface")) return KMacInterfaceUid;
   1.144 +	else if (*this==_L("KMacModeType")) return KMacModeTypeUid;
   1.145 +#endif
   1.146 +#if (defined(SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT) && defined(SYMBIAN_ENABLE_SDP_ECC))
   1.147 +    else if (*this==_L("KAlgorithmCipherEcc")) return KEccCipherUid;
   1.148 +    else if (*this==_L("KAlgorithmSignerEcc")) return KEccSignerUid;
   1.149 +#endif
   1.150 +	else
   1.151 +		{
   1.152 +		User::Panic(*this,KErrNotFound);
   1.153 +		return TUid::Null();	
   1.154 +		}		
   1.155 +	}	
   1.156 +
   1.157 +//Returns the TInt representation for the stored string value	
   1.158 +TVariantPtrC::operator TInt()
   1.159 +	{
   1.160 +	
   1.161 +	if (*this==_L("KAlgorithmHashMd2")) return KAlgorithmHashMd2;	
   1.162 +	else if (*this==_L("KAlgorithmHashMd5")) return KAlgorithmHashMd5;
   1.163 +	else if (*this==_L("KAlgorithmHashSha1")) return KAlgorithmHashSha1;
   1.164 +	else if (*this==_L("KAlgorithmHashSha224")) return KAlgorithmHashSha224;
   1.165 +	else if (*this==_L("KAlgorithmHashSha256")) return KAlgorithmHashSha256;
   1.166 +	else if (*this==_L("KAlgorithmHashSha384")) return KAlgorithmHashSha384;
   1.167 +	else if (*this==_L("KAlgorithmHashSha512")) return KAlgorithmHashSha512;
   1.168 +	else if (*this==_L("KAlgorithmRandom")) return KAlgorithmRandom;	
   1.169 +	else if (*this==_L("KAlgorithmCipherDes")) return KAlgorithmCipherDes;	
   1.170 +	else if (*this==_L("KAlgorithmCipher3Des")) return KAlgorithmCipher3Des;
   1.171 +	else if (*this==_L("KAlgorithmCipherRc2")) return KAlgorithmCipherRc2;
   1.172 +	else if (*this==_L("KAlgorithmCipherArc4")) return KAlgorithmCipherArc4;
   1.173 +	else if (*this==_L("KAlgorithmCipherAes")) return KAlgorithmCipherAes;
   1.174 +	else if (*this==_L("KAlgorithmCipherRsa")) return KAlgorithmCipherRsa;
   1.175 +	else if (*this==_L("KAlgorithmSignerRsa")) return KAlgorithmSignerRsa;
   1.176 +	else if (*this==_L("KAlgorithmSignerDsa")) return KAlgorithmSignerDsa; 
   1.177 +	else if (*this==_L("KAlgorithmVerifierRsa")) return KAlgorithmVerifierRsa;
   1.178 +	else if (*this==_L("KAlgorithmVerifierDsa")) return KAlgorithmVerifierDsa;
   1.179 +	else if (*this==_L("KAlgorithmKeyAgreementDH")) return KAlgorithmKeyAgreementDH;
   1.180 +	else if (*this==_L("KAlgorithmRSAKeyPairGenerator")) return KAlgorithmRSAKeyPairGenerator;
   1.181 +	else if (*this==_L("KAlgorithmDSAKeyPairGenerator")) return KAlgorithmDSAKeyPairGenerator;
   1.182 +	else if (*this==_L("KAlgorithmDHKeyPairGenerator")) return KAlgorithmDHKeyPairGenerator;
   1.183 +	
   1.184 +	else if (*this==_L("KHashInterface")) return KHashInterface;
   1.185 +	else if (*this==_L("KRandomInterface")) return KRandomInterface;
   1.186 +	else if (*this==_L("KSymmetricCipherInterface")) return KSymmetricCipherInterface;
   1.187 +	else if (*this==_L("KAsymmetricCipherInterface")) return KAsymmetricCipherInterface;
   1.188 +	else if (*this==_L("KSignerInterface")) return KSignerInterface;
   1.189 +	else if (*this==_L("KVerifierInterface")) return KVerifierInterface;
   1.190 +	else if (*this==_L("KKeyAgreementInterface")) return KKeyAgreementInterface;
   1.191 +	else if (*this==_L("KKeyGeneratorInterface")) return KKeyGeneratorInterface;
   1.192 +	else if (*this==_L("KKeypairGeneratorInterface")) return KKeypairGeneratorInterface;
   1.193 +	else if (*this==_L("KAsyncHashInterface")) return KAsyncHashInterface;
   1.194 +	else if (*this==_L("KAsyncRandomInterface")) return KAsyncRandomInterface;
   1.195 +	else if (*this==_L("KAsyncSymmetricCipherInterface")) return KAsyncSymmetricCipherInterface;
   1.196 +	else if (*this==_L("KAsyncAsymmetricCipherInterface")) return KAsyncAsymmetricCipherInterface;
   1.197 +	else if (*this==_L("KAsyncSignerInterface")) return KAsyncSignerInterface;
   1.198 +	else if (*this==_L("KAsyncVerifierInterface")) return KAsyncVerifierInterface;
   1.199 +	else if (*this==_L("KAsyncKeyAgreementInterface")) return KAsyncKeyAgreementInterface;
   1.200 +	else if (*this==_L("KAsyncKeyGeneratorInterface")) return KAsyncKeyGeneratorInterface;
   1.201 +	else if (*this==_L("KAsyncKeypairGeneratorInterface")) return KAsyncKeypairGeneratorInterface;
   1.202 +	
   1.203 +	else if (*this==_L("KCryptoModeEncrypt")) return KCryptoModeEncrypt;
   1.204 +	else if (*this==_L("KCryptoModeDecrypt")) return KCryptoModeDecrypt;
   1.205 +	
   1.206 +	else if (*this==_L("KOperationModeNone")) return KOperationModeNone;	
   1.207 +	else if (*this==_L("KOperationModeECB")) return KOperationModeECB;
   1.208 +	else if (*this==_L("KOperationModeCBC")) return KOperationModeCBC;
   1.209 +	else if (*this==_L("KOperationModeOFB")) return KOperationModeOFB;
   1.210 +	else if (*this==_L("KOperationModeCFB")) return KOperationModeCFB;
   1.211 +	else if (*this==_L("KOperationModeCTR")) return KOperationModeCTR;
   1.212 +	else if (*this==_L("KHashMode")) return KHashMode;
   1.213 +	else if (*this==_L("KHmacMode")) return KHmacMode;
   1.214 +	
   1.215 +	else if (*this==_L("KPaddingInterface")) return KPaddingInterface;	
   1.216 +	else if (*this==_L("KPaddingModeNone")) return KPaddingModeNone;
   1.217 +	else if (*this==_L("KPaddingModeSSLv3")) return KPaddingModeSSLv3;
   1.218 +	else if (*this==_L("KPaddingModePKCS7")) return KPaddingModePKCS7;
   1.219 +	else if (*this==_L("KPaddingModePkcs1_v1_5_Encryption")) return KPaddingModePkcs1_v1_5_Encryption;
   1.220 +	else if (*this==_L("KPaddingModePkcs1_v1_5_Signature")) return KPaddingModePkcs1_v1_5_Signature;
   1.221 +	
   1.222 +	else if (*this==_L("KTestPlugin01Des_1")) return KTestPlugin01Des_1;	
   1.223 +	else if (*this==_L("KTestPlugin01Des_2")) return KTestPlugin01Des_2;
   1.224 +	else if (*this==_L("KTestPlugin01Des_3")) return KTestPlugin01Des_3;
   1.225 +	else if (*this==_L("KTestPlugin01Des_4")) return KTestPlugin01Des_4;
   1.226 +	else if (*this==_L("KTestPlugin01Md2_1")) return KTestPlugin01Md2_1;
   1.227 +	else if (*this==_L("KTestPlugin01Md2_2")) return KTestPlugin01Md2_2;
   1.228 +	else if (*this==_L("KTestPlugin01RsaKeyGen_1")) return KTestPlugin01RsaKeyGen_1;
   1.229 +	else if (*this==_L("KTestPlugin01RsaVerifier_1")) return KTestPlugin01RsaVerifier_1;
   1.230 +	else if (*this==_L("KTestPlugin01RsaVerifier_2")) return KTestPlugin01RsaVerifier_2;
   1.231 +	
   1.232 +	else if (*this==_L("KTestPlugin02Random_1")) return KTestPlugin02Random_1;	
   1.233 +	else if (*this==_L("KTestPlugin02Md5_1")) return KTestPlugin02Md5_1;
   1.234 +	else if (*this==_L("KTestPlugin02Des_1")) return KTestPlugin02Des_1;
   1.235 +	else if (*this==_L("KTestPlugin02Des_2")) return KTestPlugin02Des_2;
   1.236 +	else if (*this==_L("KTestPlugin02Rsa_1")) return KTestPlugin02Rsa_1;
   1.237 +	else if (*this==_L("KTestPlugin02Rsa_2")) return KTestPlugin02Rsa_2;
   1.238 +	else if (*this==_L("KTestPlugin02RsaKeyGen_1")) return KTestPlugin02RsaKeyGen_1;
   1.239 +	else if (*this==_L("KTestPlugin02DHKeyGen_1")) return KTestPlugin02DHKeyGen_1;
   1.240 +	else if (*this==_L("KTestPlugin02RsaSigner_1")) return KTestPlugin02RsaSigner_1;
   1.241 +	else if (*this==_L("KTestPlugin02DHKeyAgree_1")) return KTestPlugin02DHKeyAgree_1;
   1.242 +	else if (*this==_L("KTestPlugin02Random_2")) return KTestPlugin02Random_2;
   1.243 +	
   1.244 +	else if (*this==_L("KCryptoPluginMd2")) return KCryptoPluginMd2;	
   1.245 +	else if (*this==_L("KCryptoPluginMd5")) return KCryptoPluginMd5;
   1.246 +	else if (*this==_L("KCryptoPluginSha1")) return KCryptoPluginSha1;
   1.247 +	else if (*this==_L("KCryptoPluginSha224")) return KCryptoPluginSha224;
   1.248 +	else if (*this==_L("KCryptoPluginSha256")) return KCryptoPluginSha256;
   1.249 +	else if (*this==_L("KCryptoPluginSha384")) return KCryptoPluginSha384;
   1.250 +	else if (*this==_L("KCryptoPluginSha512")) return KCryptoPluginSha512;
   1.251 +	else if (*this==_L("KCryptoPluginRandom")) return KCryptoPluginRandom;
   1.252 +	else if (*this==_L("KCryptoPluginDes")) return KCryptoPluginDes;
   1.253 +	else if (*this==_L("KCryptoPlugin3Des")) return KCryptoPlugin3Des;
   1.254 +	else if (*this==_L("KCryptoPluginAes")) return KCryptoPluginAes;
   1.255 +	else if (*this==_L("KCryptoPluginRc2")) return KCryptoPluginRc2;
   1.256 +	else if (*this==_L("KCryptoPluginArc4")) return KCryptoPluginArc4;	
   1.257 +	else if (*this==_L("KCryptoPluginRsaCipher")) return KCryptoPluginRsaCipher;
   1.258 +	else if (*this==_L("KCryptoPluginRsaSigner")) return KCryptoPluginRsaSigner;
   1.259 +	else if (*this==_L("KCryptoPluginDsaSigner")) return KCryptoPluginDsaSigner;
   1.260 +	else if (*this==_L("KCryptoPluginRsaVerifier")) return KCryptoPluginRsaVerifier;
   1.261 +	else if (*this==_L("KCryptoPluginDsaVerifier")) return KCryptoPluginDsaVerifier;
   1.262 +	else if (*this==_L("KCryptoPluginDhKeyAgreement")) return KCryptoPluginDhKeyAgreement;
   1.263 +	else if (*this==_L("KCryptoPluginDhKeyPairGen")) return KCryptoPluginDhKeyPairGen;
   1.264 +	else if (*this==_L("KCryptoPluginRsaKeyPairGen")) return KCryptoPluginRsaKeyPairGen;
   1.265 +	else if (*this==_L("KCryptoPluginDsaKeyPairGen")) return KCryptoPluginDsaKeyPairGen;
   1.266 +	
   1.267 +	else if (*this==_L("KInterfaceType")) return KInterfaceType;
   1.268 +	else if (*this==_L("KAlgorithmType")) return KAlgorithmType;
   1.269 +	else if (*this==_L("KImplementationType")) return KImplementationType;
   1.270 +	else if (*this==_L("KCreatorNameType")) return KCreatorNameType;
   1.271 +	else if (*this==_L("KIsFIPSApprovedType")) return KIsFIPSApprovedType;
   1.272 +	else if (*this==_L("KIsHardwareSupportedType")) return KIsHardwareSupportedType;
   1.273 +	else if (*this==_L("KMaxConcurrencySupportedType")) return KMaxConcurrencySupportedType;
   1.274 +	else if (*this==_L("KLatencyType")) return KLatencyType;
   1.275 +	else if (*this==_L("KThroughputType")) return KThroughputType;
   1.276 +	else if (*this==_L("KBlockSizeType")) return KBlockSizeType;
   1.277 +	else if (*this==_L("KOutputSizeType")) return KOutputSizeType;
   1.278 +	else if (*this==_L("KSupportedOperationModesType")) return KSupportedOperationModesType;
   1.279 +	else if (*this==_L("KBlockingModeType")) return KBlockingModeType;
   1.280 +	else if (*this==_L("KMaximumKeyLengthType")) return KMaximumKeyLengthType;
   1.281 +	else if (*this==_L("KSupportedPaddingModesType")) return KSupportedPaddingModesType;
   1.282 +	else if (*this==_L("KKeySupportModeType")) return KKeySupportModeType;
   1.283 +	else if (*this==_L("KConcurrencyType")) return KConcurrencyType;
   1.284 +	else if (*this==_L("KExclusiveUseType")) return KExclusiveUseType;
   1.285 +	
   1.286 +	else if (*this==_L("KExtendCharType1")) return KExtendCharType1;
   1.287 +	else if (*this==_L("KExtendCharType2")) return KExtendCharType2;
   1.288 +	else if (*this==_L("KExtendCharType3")) return KExtendCharType3;
   1.289 +	
   1.290 +	//************************** CUSTOM INTEGERS *******************************
   1.291 +	
   1.292 +	else if (*this==_L("EOpEqual")) return EOpEqual;
   1.293 +	else if (*this==_L("EOpNotEqual")) return EOpNotEqual;
   1.294 +	else if (*this==_L("EOpGreaterThan")) return EOpGreaterThan;
   1.295 +	else if (*this==_L("EOpLessThan")) return EOpLessThan;
   1.296 +	else if (*this==_L("EOpGreaterThanOrEqual")) return EOpGreaterThanOrEqual;
   1.297 +	else if (*this==_L("EOpLessThanOrEqual")) return EOpLessThanOrEqual;
   1.298 +	else if (*this==_L("EOpAscendingSort")) return EOpAscendingSort;
   1.299 +	else if (*this==_L("EOpDescendingSort")) return EOpDescendingSort;	
   1.300 +	
   1.301 +	else if (*this==_L("ERuleValueInteger")) return ERuleValueInteger;
   1.302 +	else if (*this==_L("ERuleValueDes8")) return ERuleValueDes8;
   1.303 +	else if (*this==_L("ERuleValueDes16")) return ERuleValueDes16;
   1.304 +	else if (*this==_L("ERuleValueBoolean")) return ERuleValueBoolean;
   1.305 +	
   1.306 +	else if (*this==_L("KMaxTInt")) return KMaxTInt;
   1.307 +	else if (*this==_L("NULL")) return NULL;
   1.308 +#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
   1.309 +	else if (*this==_L("KAlgorithmHashMd4")) return KAlgorithmHashMd4;
   1.310 +	else if (*this==_L("KAlgorithmCipherAesXcbcMac96")) return KAlgorithmCipherAesXcbcMac96;
   1.311 +	else if (*this==_L("KAlgorithmCipherAesXcbcPrf128")) return KAlgorithmCipherAesXcbcPrf128;
   1.312 +	else if (*this==_L("KMacInterface")) return KMacInterface;
   1.313 +	else if (*this==_L("KSymmetricCipherMode")) return KSymmetricCipherMode;
   1.314 +	else if (*this==_L("KTestPlugin01Aes")) return KTestPlugin01Aes;
   1.315 +	else if (*this==_L("KTestPlugin01XcbcMac96")) return KTestPlugin01XcbcMac96;
   1.316 +	else if (*this==_L("KTestPlugin01MacMd2_1")) return KTestPlugin01MacMd2_1;
   1.317 +	else if (*this==_L("KTestPlugin01MacMd2_2")) return KTestPlugin01MacMd2_2;
   1.318 +	else if (*this==_L("KTestPlugin02Aes")) return KTestPlugin02Aes;
   1.319 +	else if (*this==_L("KTestPlugin02XcbcMac96")) return KTestPlugin02XcbcMac96;
   1.320 +	else if (*this==_L("KTestPlugin02XcbcPrf128")) return KTestPlugin02XcbcPrf128;
   1.321 +#endif	
   1.322 +	else
   1.323 +		{
   1.324 +		User::Panic(*this,KErrNotFound);
   1.325 +		return 0;	
   1.326 +		}	
   1.327 +	}
   1.328 +	
   1.329 +TVariantPtrC::operator const TInt32*() 
   1.330 +	{
   1.331 +	
   1.332 +	if (*this==_L("KHashOperationModes")) return KHashOperationModes;
   1.333 +	else if (*this==_L("KDesCryptoModes")) return KDesCryptoModes;
   1.334 +	else if (*this==_L("K3DesCryptoModes")) return K3DesCryptoModes;
   1.335 +	else if (*this==_L("KAesCryptoModes")) return KAesCryptoModes;
   1.336 +	else if (*this==_L("KRc2CryptoModes")) return KRc2CryptoModes;
   1.337 +	else if (*this==_L("KArc4CryptoModes")) return KArc4CryptoModes;
   1.338 +
   1.339 +	else if (*this==_L("KDesPaddingModes")) return KDesPaddingModes;
   1.340 +	else if (*this==_L("K3DesPaddingModes")) return K3DesPaddingModes;
   1.341 +	else if (*this==_L("KAesPaddingModes")) return KAesPaddingModes;
   1.342 +	else if (*this==_L("KRc2PaddingModes")) return KRc2PaddingModes;
   1.343 +	else if (*this==_L("KArc4PaddingModes")) return KArc4PaddingModes;
   1.344 +	else if (*this==_L("KRSACipherPaddingModes")) return KRSACipherPaddingModes;
   1.345 +	else if (*this==_L("KRSASignerPaddingModes")) return KRSASignerPaddingModes;
   1.346 +	else if (*this==_L("KDSASignerPaddingModes")) return KDSASignerPaddingModes;
   1.347 +	else if (*this==_L("KRSAVerifierPaddingModes")) return KRSAVerifierPaddingModes;
   1.348 +	else if (*this==_L("KDSAVerifierPaddingModes")) return KDSAVerifierPaddingModes;
   1.349 +	
   1.350 +	else
   1.351 +		{
   1.352 +		User::Panic(*this,KErrNotFound);
   1.353 +		return 0;	
   1.354 +		}
   1.355 +	}
   1.356 +	
   1.357 +TVariantPtrC::operator TRomLitC16() 
   1.358 +	{
   1.359 +	
   1.360 +	if (*this==_L("KSymbian")) return KSymbian;	
   1.361 +	else if (*this==_L("KSymbianTestFramework")) return KSymbianTestFramework;
   1.362 +	else if (*this==_L("KTestFramework")) return KTestFramework;
   1.363 +	else if (*this==_L("KAlternativeName")) return KAlternativeName;
   1.364 +	
   1.365 +	else if (*this==_L("KMd2Description")) return KMd2Description;	
   1.366 +	else if (*this==_L("KMd5Description")) return KMd5Description;
   1.367 +	else if (*this==_L("KSha1Description")) return KSha1Description;
   1.368 +	else if (*this==_L("KSha224Description")) return KSha224Description;
   1.369 +	else if (*this==_L("KSha256Description")) return KSha256Description;
   1.370 +	else if (*this==_L("KSha384Description")) return KSha384Description;
   1.371 +	else if (*this==_L("KSha512Description")) return KSha512Description;
   1.372 +	else if (*this==_L("KHmacMd2Description")) return KHmacMd2Description;
   1.373 +	else if (*this==_L("KHmacMd5Description")) return KHmacMd5Description;	
   1.374 +	else if (*this==_L("KHmacSha1Description")) return KHmacSha1Description;
   1.375 +	else if (*this==_L("KHmacSha224Description")) return KHmacSha224Description;
   1.376 +	else if (*this==_L("KHmacSha256Description")) return KHmacSha256Description;
   1.377 +	else if (*this==_L("KHmacSha384Description")) return KHmacSha384Description;
   1.378 +	else if (*this==_L("KHmacSha512Description")) return KHmacSha512Description;
   1.379 +	else if (*this==_L("KRandomDescription")) return KRandomDescription;	
   1.380 +	else if (*this==_L("KDesDescription")) return KDesDescription;
   1.381 +	else if (*this==_L("K3DesDescription")) return K3DesDescription;	
   1.382 +	else if (*this==_L("KAesDescription")) return KAesDescription;
   1.383 +	else if (*this==_L("KRC2Description")) return KRC2Description;
   1.384 +	else if (*this==_L("KARC4Description")) return KARC4Description;	
   1.385 +	else if (*this==_L("KRsaCipherDescription")) return KRsaCipherDescription;
   1.386 +	else if (*this==_L("KRsaSignerDescription")) return KRsaSignerDescription;	
   1.387 +	else if (*this==_L("KDsaSignerDescription")) return KDsaSignerDescription;
   1.388 +	else if (*this==_L("KRsaVerifierDescription")) return KRsaVerifierDescription;	
   1.389 +	else if (*this==_L("KDsaVerifierDescription")) return KDsaVerifierDescription;
   1.390 +	else if (*this==_L("KDHDescription")) return KDHDescription;	
   1.391 +	else if (*this==_L("KSymmetricKeyGeneratorDescription")) return KSymmetricKeyGeneratorDescription;
   1.392 +	else if (*this==_L("KKeyPairDescription")) return KKeyPairDescription;
   1.393 +#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
   1.394 +	else if (*this==_L("KAesXcbcMac96Description")) return KAesXcbcMac96Description;
   1.395 +	else if (*this==_L("KAesXcbcPrf128Description")) return KAesXcbcPrf128Description;
   1.396 +#endif
   1.397 +	else
   1.398 +		{
   1.399 +		User::Panic(*this,KErrNotFound);
   1.400 +		return TRomLitC16();	
   1.401 +		}
   1.402 +	}
   1.403 +	
   1.404 +HBufC* TVariantPtrC::HexStringLC()
   1.405 +	{
   1.406 +	HBufC* parsedString = HBufC::NewLC(this->Length()*2);
   1.407 +	TBuf<2> pair;
   1.408 +	_LIT(KFormat2,"%02x"); 
   1.409 +						    
   1.410 +   	for(TInt i = 0; i<this->Length() ; i++)
   1.411 +    	{
   1.412 +		TInt num  = (*this)[i];
   1.413 +    	pair.Format(KFormat2,num);
   1.414 +    	parsedString->Des().Append(pair);
   1.415 +    	}
   1.416 +	    
   1.417 +	return parsedString;
   1.418 +	}
   1.419 +