os/security/crypto/weakcryptospi/test/tcryptospi/src/te_cryptospiconversion.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2007-2010 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 /**
    20  @file
    21  @internalTechnology
    22 */
    23 
    24 #include "te_cryptospiconversion.h"
    25 #include "te_cryptospidefs.h"
    26 #include <cryptospi/cryptohashapi.h>
    27 #include <cryptospi/cryptorandomapi.h>
    28 #include <cryptospi/cryptosymmetriccipherapi.h>
    29 #include <cryptospi/cryptoasymmetriccipherapi.h>
    30 #include <cryptospi/cryptosignatureapi.h>
    31 #include <cryptospi/cryptokeypairgeneratorapi.h>
    32 #include <cryptospi/cryptokeyagreementapi.h>
    33 #include <cryptospi/ruleselector.h>
    34 
    35 using namespace CryptoSpi;
    36 
    37 //Returns the Uid representation for the stored string value
    38 TVariantPtrC::operator TUid()
    39 	{
    40 	if (*this==_L("KAlgorithmHashMd2"))	return KMd2Uid;	
    41 	else if (*this==_L("KAlgorithmHashMd5")) return KMd5Uid;
    42 	else if (*this==_L("KAlgorithmHashSha1")) return KSha1Uid;
    43 	else if (*this==_L("KAlgorithmHashMd4")) return KMd4Uid;
    44 	else if (*this==_L("KAlgorithmHashSha224")) return KSha224Uid;
    45 	else if (*this==_L("KAlgorithmHashSha256")) return KSha256Uid;
    46 	else if (*this==_L("KAlgorithmHashSha384")) return KSha384Uid;
    47 	else if (*this==_L("KAlgorithmHashSha512")) return KSha512Uid;
    48 	else if (*this==_L("KAlgorithmRandom")) return KRandomUid;	
    49 	else if (*this==_L("KAlgorithmCipherDes")) return KDesUid;	
    50 	else if (*this==_L("KAlgorithmCipher3Des")) return K3DesUid;
    51 	else if (*this==_L("KAlgorithmCipherRc2")) return KRc2Uid;
    52 	else if (*this==_L("KAlgorithmCipherArc4")) return KArc4Uid;
    53 	else if (*this==_L("KAlgorithmCipherAes")) return KAesUid;
    54 	else if (*this==_L("KAlgorithmCipherMisty1")) return KMisty1Uid;
    55 	else if (*this==_L("KAlgorithmCipherMisty2")) return KMisty2Uid;
    56 	else if (*this==_L("KAlgorithmCipherKasumi")) return KKasumiUid;
    57 	else if (*this==_L("KAlgorithmCipherRsa")) return KRsaCipherUid;
    58 	else if (*this==_L("KAlgorithmSignerRsa")) return KRsaSignerUid;
    59 	else if (*this==_L("KAlgorithmSignerDsa")) return KDsaSignerUid; 
    60 	else if (*this==_L("KAlgorithmVerifierRsa")) return KRsaVerifierUid;
    61 	else if (*this==_L("KAlgorithmVerifierDsa")) return KDsaVerifierUid;
    62 	else if (*this==_L("KAlgorithmKeyAgreementDH")) return KDHAgreementUid;
    63 	else if (*this==_L("KAlgorithmRSAKeyPairGenerator")) return KRSAKeyPairGeneratorUid;
    64 	else if (*this==_L("KAlgorithmDSAKeyPairGenerator")) return KDSAKeyPairGeneratorUid;
    65 	else if (*this==_L("KAlgorithmDHKeyPairGenerator")) return KDHKeyPairGeneratorUid;
    66 
    67 	else if (*this==_L("KHashInterface")) return KHashInterfaceUid;
    68 	else if (*this==_L("KRandomInterface")) return KRandomInterfaceUid;
    69 	else if (*this==_L("KSymmetricCipherInterface")) return KSymmetricCipherInterfaceUid;
    70 	else if (*this==_L("KAsymmetricCipherInterface")) return KAsymmetricCipherInterfaceUid;
    71 	else if (*this==_L("KSignerInterface")) return KSignerInterfaceUid;
    72 	else if (*this==_L("KVerifierInterface")) return KVerifierInterfaceUid;
    73 	else if (*this==_L("KKeyAgreementInterface")) return KKeyAgreementInterfaceUid;
    74 	else if (*this==_L("KKeyGeneratorInterface")) return KKeyGeneratorInterfaceUid;
    75 	else if (*this==_L("KKeypairGeneratorInterface")) return KKeypairGeneratorInterfaceUid;
    76 	else if (*this==_L("KAsyncHashInterface")) return KAsyncHashInterfaceUid;
    77 	else if (*this==_L("KAsyncRandomInterface")) return KAsyncRandomInterfaceUid;
    78 	else if (*this==_L("KAsyncSymmetricCipherInterface")) return KAsyncSymmetricCipherInterfaceUid;
    79 	else if (*this==_L("KAsyncAsymmetricCipherInterface")) return KAsyncAsymmetricCipherInterfaceUid;
    80 	else if (*this==_L("KAsyncSignerInterface")) return KAsyncSignerInterfaceUid;
    81 	else if (*this==_L("KAsyncVerifierInterface")) return KAsyncVerifierInterfaceUid;
    82 	else if (*this==_L("KAsyncKeyAgreementInterface")) return KAsyncKeyAgreementInterfaceUid;
    83 	else if (*this==_L("KAsyncKeyGeneratorInterface")) return KAsyncKeyGeneratorInterfaceUid;
    84 	else if (*this==_L("KAsyncKeypairGeneratorInterface")) return KAsyncKeypairGeneratorInterfaceUid;
    85 	
    86 	else if (*this==_L("KCryptoModeEncrypt")) return KCryptoModeEncryptUid;
    87 	else if (*this==_L("KCryptoModeDecrypt")) return KCryptoModeDecryptUid;
    88 	
    89 	else if (*this==_L("KOperationModeNone")) return KOperationModeNoneUid;	
    90 	else if (*this==_L("KOperationModeECB")) return KOperationModeECBUid;
    91 	else if (*this==_L("KOperationModeCBC")) return KOperationModeCBCUid;
    92 	else if (*this==_L("KOperationModeOFB")) return KOperationModeOFBUid;
    93 	else if (*this==_L("KOperationModeCFB")) return KOperationModeCFBUid;
    94 	else if (*this==_L("KOperationModeCTR")) return KOperationModeCTRUid;
    95 	else if (*this==_L("KHashMode")) return KHashModeUid;
    96 	else if (*this==_L("KHmacMode")) return KHmacModeUid;
    97 	
    98 	else if (*this==_L("KPaddingInterface")) return KPaddingInterfaceUid;	
    99 	else if (*this==_L("KPaddingModeNone")) return KPaddingModeNoneUid;
   100 	else if (*this==_L("KPaddingModeSSLv3")) return KPaddingModeSSLv3Uid;
   101 	else if (*this==_L("KPaddingModePKCS7")) return KPaddingModePKCS7Uid;
   102 	else if (*this==_L("KPaddingModePkcs1_v1_5_Encryption")) return KPaddingModePkcs1_v1_5_EncryptionUid;
   103 	else if (*this==_L("KPaddingModePkcs1_v1_5_Signature")) return KPaddingModePkcs1_v1_5_SignatureUid;
   104 	
   105 	else if (*this==_L("KSymmetricKey")) return	KSymmetricKeyUid;
   106 	else if (*this==_L("KSymmetricKeyParameter")) return KSymmetricKeyParameterUid;
   107 	else if (*this==_L("KRsaKeyParameterN")) return KRsaKeyParameterNUid;
   108 	else if (*this==_L("KHmacKey")) return	KHmacKeyUid;
   109 	else if (*this==_L("KHmacKeyParameter")) return KHmacKeyParameterUid;
   110 			
   111 	else if (*this==_L("KRsaSigner")) return KRsaSignerUid;
   112 	else if (*this==_L("KDsaSigner")) return KDsaSignerUid;
   113 	
   114 	else if (*this==_L("KNone")) return KNoneUid;
   115 	else if (*this==_L("KInterfaceType")) return KInterfaceTypeUid;
   116 	else if (*this==_L("KAlgorithmType")) return KAlgorithmTypeUid;
   117 	else if (*this==_L("KImplementationType")) return KImplementationTypeUid;
   118 	else if (*this==_L("KCreatorNameType")) return KCreatorNameTypeUid;
   119 	else if (*this==_L("KIsFIPSApprovedType")) return KIsFIPSApprovedTypeUid;
   120 	else if (*this==_L("KIsHardwareSupportedType")) return KIsHardwareSupportedTypeUid;
   121 	else if (*this==_L("KMaxConcurrencySupportedType")) return KMaxConcurrencySupportedTypeUid;
   122 	else if (*this==_L("KLatencyType")) return KLatencyTypeUid;
   123 	else if (*this==_L("KThroughputType")) return KThroughputTypeUid;
   124 	else if (*this==_L("KBlockSizeType")) return KBlockSizeTypeUid;
   125 	else if (*this==_L("KOutputSizeType")) return KOutputSizeTypeUid;
   126 	else if (*this==_L("KSupportedOperationModesType")) return KSupportedOperationModesTypeUid;
   127 	else if (*this==_L("KBlockingModeType")) return KBlockingModeTypeUid;
   128 	else if (*this==_L("KMaximumKeyLengthType")) return KMaximumKeyLengthTypeUid;
   129 	else if (*this==_L("KSupportedPaddingModesType")) return KSupportedPaddingModesTypeUid;
   130 	else if (*this==_L("KKeySupportModeType")) return KKeySupportModeTypeUid;
   131 	else if (*this==_L("KConcurrencyType")) return KConcurrencyTypeUid;
   132 	else if (*this==_L("KExclusiveUseType")) return KExclusiveUseTypeUid;
   133 	
   134 	else if (*this==_L("KExtendCharType1")) return KExtendCharType1Uid;
   135 	else if (*this==_L("KExtendCharType2")) return KExtendCharType2Uid;
   136 	else if (*this==_L("KExtendCharType3")) return KExtendCharType3Uid;
   137 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
   138 	else if (*this==_L("KAlgorithmCipherAesXcbcMac96")) return KAesXcbcMac96Uid;
   139 	else if (*this==_L("KAlgorithmCipherAesXcbcPrf128")) return KAesXcbcPrf128Uid;
   140 	else if (*this==_L("KMacInterface")) return KMacInterfaceUid;
   141 	else if (*this==_L("KMacModeType")) return KMacModeTypeUid;
   142 #endif
   143 #if (defined(SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT) && defined(SYMBIAN_ENABLE_SDP_ECC))
   144     else if (*this==_L("KAlgorithmCipherEcc")) return KEccCipherUid;
   145     else if (*this==_L("KAlgorithmSignerEcc")) return KEccSignerUid;
   146 #endif
   147 	else
   148 		{
   149 		User::Panic(*this,KErrNotFound);
   150 		return TUid::Null();	
   151 		}		
   152 	}	
   153 
   154 //Returns the TInt representation for the stored string value	
   155 TVariantPtrC::operator TInt()
   156 	{
   157 	
   158 	if (*this==_L("KAlgorithmHashMd2")) return KAlgorithmHashMd2;	
   159 	else if (*this==_L("KAlgorithmHashMd5")) return KAlgorithmHashMd5;
   160 	else if (*this==_L("KAlgorithmHashSha1")) return KAlgorithmHashSha1;
   161 	else if (*this==_L("KAlgorithmHashSha224")) return KAlgorithmHashSha224;
   162 	else if (*this==_L("KAlgorithmHashSha256")) return KAlgorithmHashSha256;
   163 	else if (*this==_L("KAlgorithmHashSha384")) return KAlgorithmHashSha384;
   164 	else if (*this==_L("KAlgorithmHashSha512")) return KAlgorithmHashSha512;
   165 	else if (*this==_L("KAlgorithmRandom")) return KAlgorithmRandom;	
   166 	else if (*this==_L("KAlgorithmCipherDes")) return KAlgorithmCipherDes;	
   167 	else if (*this==_L("KAlgorithmCipher3Des")) return KAlgorithmCipher3Des;
   168 	else if (*this==_L("KAlgorithmCipherRc2")) return KAlgorithmCipherRc2;
   169 	else if (*this==_L("KAlgorithmCipherArc4")) return KAlgorithmCipherArc4;
   170 	else if (*this==_L("KAlgorithmCipherAes")) return KAlgorithmCipherAes;
   171 	else if (*this==_L("KAlgorithmCipherRsa")) return KAlgorithmCipherRsa;
   172 	else if (*this==_L("KAlgorithmSignerRsa")) return KAlgorithmSignerRsa;
   173 	else if (*this==_L("KAlgorithmSignerDsa")) return KAlgorithmSignerDsa; 
   174 	else if (*this==_L("KAlgorithmVerifierRsa")) return KAlgorithmVerifierRsa;
   175 	else if (*this==_L("KAlgorithmVerifierDsa")) return KAlgorithmVerifierDsa;
   176 	else if (*this==_L("KAlgorithmKeyAgreementDH")) return KAlgorithmKeyAgreementDH;
   177 	else if (*this==_L("KAlgorithmRSAKeyPairGenerator")) return KAlgorithmRSAKeyPairGenerator;
   178 	else if (*this==_L("KAlgorithmDSAKeyPairGenerator")) return KAlgorithmDSAKeyPairGenerator;
   179 	else if (*this==_L("KAlgorithmDHKeyPairGenerator")) return KAlgorithmDHKeyPairGenerator;
   180 	
   181 	else if (*this==_L("KHashInterface")) return KHashInterface;
   182 	else if (*this==_L("KRandomInterface")) return KRandomInterface;
   183 	else if (*this==_L("KSymmetricCipherInterface")) return KSymmetricCipherInterface;
   184 	else if (*this==_L("KAsymmetricCipherInterface")) return KAsymmetricCipherInterface;
   185 	else if (*this==_L("KSignerInterface")) return KSignerInterface;
   186 	else if (*this==_L("KVerifierInterface")) return KVerifierInterface;
   187 	else if (*this==_L("KKeyAgreementInterface")) return KKeyAgreementInterface;
   188 	else if (*this==_L("KKeyGeneratorInterface")) return KKeyGeneratorInterface;
   189 	else if (*this==_L("KKeypairGeneratorInterface")) return KKeypairGeneratorInterface;
   190 	else if (*this==_L("KAsyncHashInterface")) return KAsyncHashInterface;
   191 	else if (*this==_L("KAsyncRandomInterface")) return KAsyncRandomInterface;
   192 	else if (*this==_L("KAsyncSymmetricCipherInterface")) return KAsyncSymmetricCipherInterface;
   193 	else if (*this==_L("KAsyncAsymmetricCipherInterface")) return KAsyncAsymmetricCipherInterface;
   194 	else if (*this==_L("KAsyncSignerInterface")) return KAsyncSignerInterface;
   195 	else if (*this==_L("KAsyncVerifierInterface")) return KAsyncVerifierInterface;
   196 	else if (*this==_L("KAsyncKeyAgreementInterface")) return KAsyncKeyAgreementInterface;
   197 	else if (*this==_L("KAsyncKeyGeneratorInterface")) return KAsyncKeyGeneratorInterface;
   198 	else if (*this==_L("KAsyncKeypairGeneratorInterface")) return KAsyncKeypairGeneratorInterface;
   199 	
   200 	else if (*this==_L("KCryptoModeEncrypt")) return KCryptoModeEncrypt;
   201 	else if (*this==_L("KCryptoModeDecrypt")) return KCryptoModeDecrypt;
   202 	
   203 	else if (*this==_L("KOperationModeNone")) return KOperationModeNone;	
   204 	else if (*this==_L("KOperationModeECB")) return KOperationModeECB;
   205 	else if (*this==_L("KOperationModeCBC")) return KOperationModeCBC;
   206 	else if (*this==_L("KOperationModeOFB")) return KOperationModeOFB;
   207 	else if (*this==_L("KOperationModeCFB")) return KOperationModeCFB;
   208 	else if (*this==_L("KOperationModeCTR")) return KOperationModeCTR;
   209 	else if (*this==_L("KHashMode")) return KHashMode;
   210 	else if (*this==_L("KHmacMode")) return KHmacMode;
   211 	
   212 	else if (*this==_L("KPaddingInterface")) return KPaddingInterface;	
   213 	else if (*this==_L("KPaddingModeNone")) return KPaddingModeNone;
   214 	else if (*this==_L("KPaddingModeSSLv3")) return KPaddingModeSSLv3;
   215 	else if (*this==_L("KPaddingModePKCS7")) return KPaddingModePKCS7;
   216 	else if (*this==_L("KPaddingModePkcs1_v1_5_Encryption")) return KPaddingModePkcs1_v1_5_Encryption;
   217 	else if (*this==_L("KPaddingModePkcs1_v1_5_Signature")) return KPaddingModePkcs1_v1_5_Signature;
   218 	
   219 	else if (*this==_L("KTestPlugin01Des_1")) return KTestPlugin01Des_1;	
   220 	else if (*this==_L("KTestPlugin01Des_2")) return KTestPlugin01Des_2;
   221 	else if (*this==_L("KTestPlugin01Des_3")) return KTestPlugin01Des_3;
   222 	else if (*this==_L("KTestPlugin01Des_4")) return KTestPlugin01Des_4;
   223 	else if (*this==_L("KTestPlugin01Md2_1")) return KTestPlugin01Md2_1;
   224 	else if (*this==_L("KTestPlugin01Md2_2")) return KTestPlugin01Md2_2;
   225 	else if (*this==_L("KTestPlugin01RsaKeyGen_1")) return KTestPlugin01RsaKeyGen_1;
   226 	else if (*this==_L("KTestPlugin01RsaVerifier_1")) return KTestPlugin01RsaVerifier_1;
   227 	else if (*this==_L("KTestPlugin01RsaVerifier_2")) return KTestPlugin01RsaVerifier_2;
   228 	
   229 	else if (*this==_L("KTestPlugin02Random_1")) return KTestPlugin02Random_1;	
   230 	else if (*this==_L("KTestPlugin02Md5_1")) return KTestPlugin02Md5_1;
   231 	else if (*this==_L("KTestPlugin02Des_1")) return KTestPlugin02Des_1;
   232 	else if (*this==_L("KTestPlugin02Des_2")) return KTestPlugin02Des_2;
   233 	else if (*this==_L("KTestPlugin02Rsa_1")) return KTestPlugin02Rsa_1;
   234 	else if (*this==_L("KTestPlugin02Rsa_2")) return KTestPlugin02Rsa_2;
   235 	else if (*this==_L("KTestPlugin02RsaKeyGen_1")) return KTestPlugin02RsaKeyGen_1;
   236 	else if (*this==_L("KTestPlugin02DHKeyGen_1")) return KTestPlugin02DHKeyGen_1;
   237 	else if (*this==_L("KTestPlugin02RsaSigner_1")) return KTestPlugin02RsaSigner_1;
   238 	else if (*this==_L("KTestPlugin02DHKeyAgree_1")) return KTestPlugin02DHKeyAgree_1;
   239 	else if (*this==_L("KTestPlugin02Random_2")) return KTestPlugin02Random_2;
   240 	
   241 	else if (*this==_L("KCryptoPluginMd2")) return KCryptoPluginMd2;	
   242 	else if (*this==_L("KCryptoPluginMd5")) return KCryptoPluginMd5;
   243 	else if (*this==_L("KCryptoPluginSha1")) return KCryptoPluginSha1;
   244 	else if (*this==_L("KCryptoPluginSha224")) return KCryptoPluginSha224;
   245 	else if (*this==_L("KCryptoPluginSha256")) return KCryptoPluginSha256;
   246 	else if (*this==_L("KCryptoPluginSha384")) return KCryptoPluginSha384;
   247 	else if (*this==_L("KCryptoPluginSha512")) return KCryptoPluginSha512;
   248 	else if (*this==_L("KCryptoPluginRandom")) return KCryptoPluginRandom;
   249 	else if (*this==_L("KCryptoPluginDes")) return KCryptoPluginDes;
   250 	else if (*this==_L("KCryptoPlugin3Des")) return KCryptoPlugin3Des;
   251 	else if (*this==_L("KCryptoPluginAes")) return KCryptoPluginAes;
   252 	else if (*this==_L("KCryptoPluginRc2")) return KCryptoPluginRc2;
   253 	else if (*this==_L("KCryptoPluginArc4")) return KCryptoPluginArc4;	
   254 	else if (*this==_L("KCryptoPluginRsaCipher")) return KCryptoPluginRsaCipher;
   255 	else if (*this==_L("KCryptoPluginRsaSigner")) return KCryptoPluginRsaSigner;
   256 	else if (*this==_L("KCryptoPluginDsaSigner")) return KCryptoPluginDsaSigner;
   257 	else if (*this==_L("KCryptoPluginRsaVerifier")) return KCryptoPluginRsaVerifier;
   258 	else if (*this==_L("KCryptoPluginDsaVerifier")) return KCryptoPluginDsaVerifier;
   259 	else if (*this==_L("KCryptoPluginDhKeyAgreement")) return KCryptoPluginDhKeyAgreement;
   260 	else if (*this==_L("KCryptoPluginDhKeyPairGen")) return KCryptoPluginDhKeyPairGen;
   261 	else if (*this==_L("KCryptoPluginRsaKeyPairGen")) return KCryptoPluginRsaKeyPairGen;
   262 	else if (*this==_L("KCryptoPluginDsaKeyPairGen")) return KCryptoPluginDsaKeyPairGen;
   263 	
   264 	else if (*this==_L("KInterfaceType")) return KInterfaceType;
   265 	else if (*this==_L("KAlgorithmType")) return KAlgorithmType;
   266 	else if (*this==_L("KImplementationType")) return KImplementationType;
   267 	else if (*this==_L("KCreatorNameType")) return KCreatorNameType;
   268 	else if (*this==_L("KIsFIPSApprovedType")) return KIsFIPSApprovedType;
   269 	else if (*this==_L("KIsHardwareSupportedType")) return KIsHardwareSupportedType;
   270 	else if (*this==_L("KMaxConcurrencySupportedType")) return KMaxConcurrencySupportedType;
   271 	else if (*this==_L("KLatencyType")) return KLatencyType;
   272 	else if (*this==_L("KThroughputType")) return KThroughputType;
   273 	else if (*this==_L("KBlockSizeType")) return KBlockSizeType;
   274 	else if (*this==_L("KOutputSizeType")) return KOutputSizeType;
   275 	else if (*this==_L("KSupportedOperationModesType")) return KSupportedOperationModesType;
   276 	else if (*this==_L("KBlockingModeType")) return KBlockingModeType;
   277 	else if (*this==_L("KMaximumKeyLengthType")) return KMaximumKeyLengthType;
   278 	else if (*this==_L("KSupportedPaddingModesType")) return KSupportedPaddingModesType;
   279 	else if (*this==_L("KKeySupportModeType")) return KKeySupportModeType;
   280 	else if (*this==_L("KConcurrencyType")) return KConcurrencyType;
   281 	else if (*this==_L("KExclusiveUseType")) return KExclusiveUseType;
   282 	
   283 	else if (*this==_L("KExtendCharType1")) return KExtendCharType1;
   284 	else if (*this==_L("KExtendCharType2")) return KExtendCharType2;
   285 	else if (*this==_L("KExtendCharType3")) return KExtendCharType3;
   286 	
   287 	//************************** CUSTOM INTEGERS *******************************
   288 	
   289 	else if (*this==_L("EOpEqual")) return EOpEqual;
   290 	else if (*this==_L("EOpNotEqual")) return EOpNotEqual;
   291 	else if (*this==_L("EOpGreaterThan")) return EOpGreaterThan;
   292 	else if (*this==_L("EOpLessThan")) return EOpLessThan;
   293 	else if (*this==_L("EOpGreaterThanOrEqual")) return EOpGreaterThanOrEqual;
   294 	else if (*this==_L("EOpLessThanOrEqual")) return EOpLessThanOrEqual;
   295 	else if (*this==_L("EOpAscendingSort")) return EOpAscendingSort;
   296 	else if (*this==_L("EOpDescendingSort")) return EOpDescendingSort;	
   297 	
   298 	else if (*this==_L("ERuleValueInteger")) return ERuleValueInteger;
   299 	else if (*this==_L("ERuleValueDes8")) return ERuleValueDes8;
   300 	else if (*this==_L("ERuleValueDes16")) return ERuleValueDes16;
   301 	else if (*this==_L("ERuleValueBoolean")) return ERuleValueBoolean;
   302 	
   303 	else if (*this==_L("KMaxTInt")) return KMaxTInt;
   304 	else if (*this==_L("NULL")) return NULL;
   305 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
   306 	else if (*this==_L("KAlgorithmHashMd4")) return KAlgorithmHashMd4;
   307 	else if (*this==_L("KAlgorithmCipherAesXcbcMac96")) return KAlgorithmCipherAesXcbcMac96;
   308 	else if (*this==_L("KAlgorithmCipherAesXcbcPrf128")) return KAlgorithmCipherAesXcbcPrf128;
   309 	else if (*this==_L("KMacInterface")) return KMacInterface;
   310 	else if (*this==_L("KSymmetricCipherMode")) return KSymmetricCipherMode;
   311 	else if (*this==_L("KTestPlugin01Aes")) return KTestPlugin01Aes;
   312 	else if (*this==_L("KTestPlugin01XcbcMac96")) return KTestPlugin01XcbcMac96;
   313 	else if (*this==_L("KTestPlugin01MacMd2_1")) return KTestPlugin01MacMd2_1;
   314 	else if (*this==_L("KTestPlugin01MacMd2_2")) return KTestPlugin01MacMd2_2;
   315 	else if (*this==_L("KTestPlugin02Aes")) return KTestPlugin02Aes;
   316 	else if (*this==_L("KTestPlugin02XcbcMac96")) return KTestPlugin02XcbcMac96;
   317 	else if (*this==_L("KTestPlugin02XcbcPrf128")) return KTestPlugin02XcbcPrf128;
   318 #endif	
   319 	else
   320 		{
   321 		User::Panic(*this,KErrNotFound);
   322 		return 0;	
   323 		}	
   324 	}
   325 	
   326 TVariantPtrC::operator const TInt32*() 
   327 	{
   328 	
   329 	if (*this==_L("KHashOperationModes")) return KHashOperationModes;
   330 	else if (*this==_L("KDesCryptoModes")) return KDesCryptoModes;
   331 	else if (*this==_L("K3DesCryptoModes")) return K3DesCryptoModes;
   332 	else if (*this==_L("KAesCryptoModes")) return KAesCryptoModes;
   333 	else if (*this==_L("KRc2CryptoModes")) return KRc2CryptoModes;
   334 	else if (*this==_L("KArc4CryptoModes")) return KArc4CryptoModes;
   335 
   336 	else if (*this==_L("KDesPaddingModes")) return KDesPaddingModes;
   337 	else if (*this==_L("K3DesPaddingModes")) return K3DesPaddingModes;
   338 	else if (*this==_L("KAesPaddingModes")) return KAesPaddingModes;
   339 	else if (*this==_L("KRc2PaddingModes")) return KRc2PaddingModes;
   340 	else if (*this==_L("KArc4PaddingModes")) return KArc4PaddingModes;
   341 	else if (*this==_L("KRSACipherPaddingModes")) return KRSACipherPaddingModes;
   342 	else if (*this==_L("KRSASignerPaddingModes")) return KRSASignerPaddingModes;
   343 	else if (*this==_L("KDSASignerPaddingModes")) return KDSASignerPaddingModes;
   344 	else if (*this==_L("KRSAVerifierPaddingModes")) return KRSAVerifierPaddingModes;
   345 	else if (*this==_L("KDSAVerifierPaddingModes")) return KDSAVerifierPaddingModes;
   346 	
   347 	else
   348 		{
   349 		User::Panic(*this,KErrNotFound);
   350 		return 0;	
   351 		}
   352 	}
   353 	
   354 TVariantPtrC::operator TRomLitC16() 
   355 	{
   356 	
   357 	if (*this==_L("KSymbian")) return KSymbian;	
   358 	else if (*this==_L("KSymbianTestFramework")) return KSymbianTestFramework;
   359 	else if (*this==_L("KTestFramework")) return KTestFramework;
   360 	else if (*this==_L("KAlternativeName")) return KAlternativeName;
   361 	
   362 	else if (*this==_L("KMd2Description")) return KMd2Description;	
   363 	else if (*this==_L("KMd5Description")) return KMd5Description;
   364 	else if (*this==_L("KSha1Description")) return KSha1Description;
   365 	else if (*this==_L("KSha224Description")) return KSha224Description;
   366 	else if (*this==_L("KSha256Description")) return KSha256Description;
   367 	else if (*this==_L("KSha384Description")) return KSha384Description;
   368 	else if (*this==_L("KSha512Description")) return KSha512Description;
   369 	else if (*this==_L("KHmacMd2Description")) return KHmacMd2Description;
   370 	else if (*this==_L("KHmacMd5Description")) return KHmacMd5Description;	
   371 	else if (*this==_L("KHmacSha1Description")) return KHmacSha1Description;
   372 	else if (*this==_L("KHmacSha224Description")) return KHmacSha224Description;
   373 	else if (*this==_L("KHmacSha256Description")) return KHmacSha256Description;
   374 	else if (*this==_L("KHmacSha384Description")) return KHmacSha384Description;
   375 	else if (*this==_L("KHmacSha512Description")) return KHmacSha512Description;
   376 	else if (*this==_L("KRandomDescription")) return KRandomDescription;	
   377 	else if (*this==_L("KDesDescription")) return KDesDescription;
   378 	else if (*this==_L("K3DesDescription")) return K3DesDescription;	
   379 	else if (*this==_L("KAesDescription")) return KAesDescription;
   380 	else if (*this==_L("KRC2Description")) return KRC2Description;
   381 	else if (*this==_L("KARC4Description")) return KARC4Description;	
   382 	else if (*this==_L("KRsaCipherDescription")) return KRsaCipherDescription;
   383 	else if (*this==_L("KRsaSignerDescription")) return KRsaSignerDescription;	
   384 	else if (*this==_L("KDsaSignerDescription")) return KDsaSignerDescription;
   385 	else if (*this==_L("KRsaVerifierDescription")) return KRsaVerifierDescription;	
   386 	else if (*this==_L("KDsaVerifierDescription")) return KDsaVerifierDescription;
   387 	else if (*this==_L("KDHDescription")) return KDHDescription;	
   388 	else if (*this==_L("KSymmetricKeyGeneratorDescription")) return KSymmetricKeyGeneratorDescription;
   389 	else if (*this==_L("KKeyPairDescription")) return KKeyPairDescription;
   390 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
   391 	else if (*this==_L("KAesXcbcMac96Description")) return KAesXcbcMac96Description;
   392 	else if (*this==_L("KAesXcbcPrf128Description")) return KAesXcbcPrf128Description;
   393 #endif
   394 	else
   395 		{
   396 		User::Panic(*this,KErrNotFound);
   397 		return TRomLitC16();	
   398 		}
   399 	}
   400 	
   401 HBufC* TVariantPtrC::HexStringLC()
   402 	{
   403 	HBufC* parsedString = HBufC::NewLC(this->Length()*2);
   404 	TBuf<2> pair;
   405 	_LIT(KFormat2,"%02x"); 
   406 						    
   407    	for(TInt i = 0; i<this->Length() ; i++)
   408     	{
   409 		TInt num  = (*this)[i];
   410     	pair.Format(KFormat2,num);
   411     	parsedString->Des().Append(pair);
   412     	}
   413 	    
   414 	return parsedString;
   415 	}
   416