crypto/weakcryptospi/test/tcryptospi/src/te_cryptospiconversion.cpp
changeset 8 35751d3474b7
child 15 da2ae96f639b
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2007-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 /**
       
    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 "cryptosymmetriccipherapi.h"
       
    29 #include "cryptoasymmetriccipherapi.h"
       
    30 #include "cryptosignatureapi.h"
       
    31 #include "cryptokeypairgeneratorapi.h"
       
    32 #include "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 	else
       
   144 		{
       
   145 		User::Panic(*this,KErrNotFound);
       
   146 		return TUid::Null();	
       
   147 		}		
       
   148 	}	
       
   149 
       
   150 //Returns the TInt representation for the stored string value	
       
   151 TVariantPtrC::operator TInt()
       
   152 	{
       
   153 	
       
   154 	if (*this==_L("KAlgorithmHashMd2")) return KAlgorithmHashMd2;	
       
   155 	else if (*this==_L("KAlgorithmHashMd5")) return KAlgorithmHashMd5;
       
   156 	else if (*this==_L("KAlgorithmHashSha1")) return KAlgorithmHashSha1;
       
   157 	else if (*this==_L("KAlgorithmHashSha224")) return KAlgorithmHashSha224;
       
   158 	else if (*this==_L("KAlgorithmHashSha256")) return KAlgorithmHashSha256;
       
   159 	else if (*this==_L("KAlgorithmHashSha384")) return KAlgorithmHashSha384;
       
   160 	else if (*this==_L("KAlgorithmHashSha512")) return KAlgorithmHashSha512;
       
   161 	else if (*this==_L("KAlgorithmRandom")) return KAlgorithmRandom;	
       
   162 	else if (*this==_L("KAlgorithmCipherDes")) return KAlgorithmCipherDes;	
       
   163 	else if (*this==_L("KAlgorithmCipher3Des")) return KAlgorithmCipher3Des;
       
   164 	else if (*this==_L("KAlgorithmCipherRc2")) return KAlgorithmCipherRc2;
       
   165 	else if (*this==_L("KAlgorithmCipherArc4")) return KAlgorithmCipherArc4;
       
   166 	else if (*this==_L("KAlgorithmCipherAes")) return KAlgorithmCipherAes;
       
   167 	else if (*this==_L("KAlgorithmCipherRsa")) return KAlgorithmCipherRsa;
       
   168 	else if (*this==_L("KAlgorithmSignerRsa")) return KAlgorithmSignerRsa;
       
   169 	else if (*this==_L("KAlgorithmSignerDsa")) return KAlgorithmSignerDsa; 
       
   170 	else if (*this==_L("KAlgorithmVerifierRsa")) return KAlgorithmVerifierRsa;
       
   171 	else if (*this==_L("KAlgorithmVerifierDsa")) return KAlgorithmVerifierDsa;
       
   172 	else if (*this==_L("KAlgorithmKeyAgreementDH")) return KAlgorithmKeyAgreementDH;
       
   173 	else if (*this==_L("KAlgorithmRSAKeyPairGenerator")) return KAlgorithmRSAKeyPairGenerator;
       
   174 	else if (*this==_L("KAlgorithmDSAKeyPairGenerator")) return KAlgorithmDSAKeyPairGenerator;
       
   175 	else if (*this==_L("KAlgorithmDHKeyPairGenerator")) return KAlgorithmDHKeyPairGenerator;
       
   176 	
       
   177 	else if (*this==_L("KHashInterface")) return KHashInterface;
       
   178 	else if (*this==_L("KRandomInterface")) return KRandomInterface;
       
   179 	else if (*this==_L("KSymmetricCipherInterface")) return KSymmetricCipherInterface;
       
   180 	else if (*this==_L("KAsymmetricCipherInterface")) return KAsymmetricCipherInterface;
       
   181 	else if (*this==_L("KSignerInterface")) return KSignerInterface;
       
   182 	else if (*this==_L("KVerifierInterface")) return KVerifierInterface;
       
   183 	else if (*this==_L("KKeyAgreementInterface")) return KKeyAgreementInterface;
       
   184 	else if (*this==_L("KKeyGeneratorInterface")) return KKeyGeneratorInterface;
       
   185 	else if (*this==_L("KKeypairGeneratorInterface")) return KKeypairGeneratorInterface;
       
   186 	else if (*this==_L("KAsyncHashInterface")) return KAsyncHashInterface;
       
   187 	else if (*this==_L("KAsyncRandomInterface")) return KAsyncRandomInterface;
       
   188 	else if (*this==_L("KAsyncSymmetricCipherInterface")) return KAsyncSymmetricCipherInterface;
       
   189 	else if (*this==_L("KAsyncAsymmetricCipherInterface")) return KAsyncAsymmetricCipherInterface;
       
   190 	else if (*this==_L("KAsyncSignerInterface")) return KAsyncSignerInterface;
       
   191 	else if (*this==_L("KAsyncVerifierInterface")) return KAsyncVerifierInterface;
       
   192 	else if (*this==_L("KAsyncKeyAgreementInterface")) return KAsyncKeyAgreementInterface;
       
   193 	else if (*this==_L("KAsyncKeyGeneratorInterface")) return KAsyncKeyGeneratorInterface;
       
   194 	else if (*this==_L("KAsyncKeypairGeneratorInterface")) return KAsyncKeypairGeneratorInterface;
       
   195 	
       
   196 	else if (*this==_L("KCryptoModeEncrypt")) return KCryptoModeEncrypt;
       
   197 	else if (*this==_L("KCryptoModeDecrypt")) return KCryptoModeDecrypt;
       
   198 	
       
   199 	else if (*this==_L("KOperationModeNone")) return KOperationModeNone;	
       
   200 	else if (*this==_L("KOperationModeECB")) return KOperationModeECB;
       
   201 	else if (*this==_L("KOperationModeCBC")) return KOperationModeCBC;
       
   202 	else if (*this==_L("KOperationModeOFB")) return KOperationModeOFB;
       
   203 	else if (*this==_L("KOperationModeCFB")) return KOperationModeCFB;
       
   204 	else if (*this==_L("KOperationModeCTR")) return KOperationModeCTR;
       
   205 	else if (*this==_L("KHashMode")) return KHashMode;
       
   206 	else if (*this==_L("KHmacMode")) return KHmacMode;
       
   207 	
       
   208 	else if (*this==_L("KPaddingInterface")) return KPaddingInterface;	
       
   209 	else if (*this==_L("KPaddingModeNone")) return KPaddingModeNone;
       
   210 	else if (*this==_L("KPaddingModeSSLv3")) return KPaddingModeSSLv3;
       
   211 	else if (*this==_L("KPaddingModePKCS7")) return KPaddingModePKCS7;
       
   212 	else if (*this==_L("KPaddingModePkcs1_v1_5_Encryption")) return KPaddingModePkcs1_v1_5_Encryption;
       
   213 	else if (*this==_L("KPaddingModePkcs1_v1_5_Signature")) return KPaddingModePkcs1_v1_5_Signature;
       
   214 	
       
   215 	else if (*this==_L("KTestPlugin01Des_1")) return KTestPlugin01Des_1;	
       
   216 	else if (*this==_L("KTestPlugin01Des_2")) return KTestPlugin01Des_2;
       
   217 	else if (*this==_L("KTestPlugin01Des_3")) return KTestPlugin01Des_3;
       
   218 	else if (*this==_L("KTestPlugin01Des_4")) return KTestPlugin01Des_4;
       
   219 	else if (*this==_L("KTestPlugin01Md2_1")) return KTestPlugin01Md2_1;
       
   220 	else if (*this==_L("KTestPlugin01Md2_2")) return KTestPlugin01Md2_2;
       
   221 	else if (*this==_L("KTestPlugin01RsaKeyGen_1")) return KTestPlugin01RsaKeyGen_1;
       
   222 	else if (*this==_L("KTestPlugin01RsaVerifier_1")) return KTestPlugin01RsaVerifier_1;
       
   223 	else if (*this==_L("KTestPlugin01RsaVerifier_2")) return KTestPlugin01RsaVerifier_2;
       
   224 	
       
   225 	else if (*this==_L("KTestPlugin02Random_1")) return KTestPlugin02Random_1;	
       
   226 	else if (*this==_L("KTestPlugin02Md5_1")) return KTestPlugin02Md5_1;
       
   227 	else if (*this==_L("KTestPlugin02Des_1")) return KTestPlugin02Des_1;
       
   228 	else if (*this==_L("KTestPlugin02Des_2")) return KTestPlugin02Des_2;
       
   229 	else if (*this==_L("KTestPlugin02Rsa_1")) return KTestPlugin02Rsa_1;
       
   230 	else if (*this==_L("KTestPlugin02Rsa_2")) return KTestPlugin02Rsa_2;
       
   231 	else if (*this==_L("KTestPlugin02RsaKeyGen_1")) return KTestPlugin02RsaKeyGen_1;
       
   232 	else if (*this==_L("KTestPlugin02DHKeyGen_1")) return KTestPlugin02DHKeyGen_1;
       
   233 	else if (*this==_L("KTestPlugin02RsaSigner_1")) return KTestPlugin02RsaSigner_1;
       
   234 	else if (*this==_L("KTestPlugin02DHKeyAgree_1")) return KTestPlugin02DHKeyAgree_1;
       
   235 	else if (*this==_L("KTestPlugin02Random_2")) return KTestPlugin02Random_2;
       
   236 	
       
   237 	else if (*this==_L("KCryptoPluginMd2")) return KCryptoPluginMd2;	
       
   238 	else if (*this==_L("KCryptoPluginMd5")) return KCryptoPluginMd5;
       
   239 	else if (*this==_L("KCryptoPluginSha1")) return KCryptoPluginSha1;
       
   240 	else if (*this==_L("KCryptoPluginSha224")) return KCryptoPluginSha224;
       
   241 	else if (*this==_L("KCryptoPluginSha256")) return KCryptoPluginSha256;
       
   242 	else if (*this==_L("KCryptoPluginSha384")) return KCryptoPluginSha384;
       
   243 	else if (*this==_L("KCryptoPluginSha512")) return KCryptoPluginSha512;
       
   244 	else if (*this==_L("KCryptoPluginRandom")) return KCryptoPluginRandom;
       
   245 	else if (*this==_L("KCryptoPluginDes")) return KCryptoPluginDes;
       
   246 	else if (*this==_L("KCryptoPlugin3Des")) return KCryptoPlugin3Des;
       
   247 	else if (*this==_L("KCryptoPluginAes")) return KCryptoPluginAes;
       
   248 	else if (*this==_L("KCryptoPluginRc2")) return KCryptoPluginRc2;
       
   249 	else if (*this==_L("KCryptoPluginArc4")) return KCryptoPluginArc4;	
       
   250 	else if (*this==_L("KCryptoPluginRsaCipher")) return KCryptoPluginRsaCipher;
       
   251 	else if (*this==_L("KCryptoPluginRsaSigner")) return KCryptoPluginRsaSigner;
       
   252 	else if (*this==_L("KCryptoPluginDsaSigner")) return KCryptoPluginDsaSigner;
       
   253 	else if (*this==_L("KCryptoPluginRsaVerifier")) return KCryptoPluginRsaVerifier;
       
   254 	else if (*this==_L("KCryptoPluginDsaVerifier")) return KCryptoPluginDsaVerifier;
       
   255 	else if (*this==_L("KCryptoPluginDhKeyAgreement")) return KCryptoPluginDhKeyAgreement;
       
   256 	else if (*this==_L("KCryptoPluginDhKeyPairGen")) return KCryptoPluginDhKeyPairGen;
       
   257 	else if (*this==_L("KCryptoPluginRsaKeyPairGen")) return KCryptoPluginRsaKeyPairGen;
       
   258 	else if (*this==_L("KCryptoPluginDsaKeyPairGen")) return KCryptoPluginDsaKeyPairGen;
       
   259 	
       
   260 	else if (*this==_L("KInterfaceType")) return KInterfaceType;
       
   261 	else if (*this==_L("KAlgorithmType")) return KAlgorithmType;
       
   262 	else if (*this==_L("KImplementationType")) return KImplementationType;
       
   263 	else if (*this==_L("KCreatorNameType")) return KCreatorNameType;
       
   264 	else if (*this==_L("KIsFIPSApprovedType")) return KIsFIPSApprovedType;
       
   265 	else if (*this==_L("KIsHardwareSupportedType")) return KIsHardwareSupportedType;
       
   266 	else if (*this==_L("KMaxConcurrencySupportedType")) return KMaxConcurrencySupportedType;
       
   267 	else if (*this==_L("KLatencyType")) return KLatencyType;
       
   268 	else if (*this==_L("KThroughputType")) return KThroughputType;
       
   269 	else if (*this==_L("KBlockSizeType")) return KBlockSizeType;
       
   270 	else if (*this==_L("KOutputSizeType")) return KOutputSizeType;
       
   271 	else if (*this==_L("KSupportedOperationModesType")) return KSupportedOperationModesType;
       
   272 	else if (*this==_L("KBlockingModeType")) return KBlockingModeType;
       
   273 	else if (*this==_L("KMaximumKeyLengthType")) return KMaximumKeyLengthType;
       
   274 	else if (*this==_L("KSupportedPaddingModesType")) return KSupportedPaddingModesType;
       
   275 	else if (*this==_L("KKeySupportModeType")) return KKeySupportModeType;
       
   276 	else if (*this==_L("KConcurrencyType")) return KConcurrencyType;
       
   277 	else if (*this==_L("KExclusiveUseType")) return KExclusiveUseType;
       
   278 	
       
   279 	else if (*this==_L("KExtendCharType1")) return KExtendCharType1;
       
   280 	else if (*this==_L("KExtendCharType2")) return KExtendCharType2;
       
   281 	else if (*this==_L("KExtendCharType3")) return KExtendCharType3;
       
   282 	
       
   283 	//************************** CUSTOM INTEGERS *******************************
       
   284 	
       
   285 	else if (*this==_L("EOpEqual")) return EOpEqual;
       
   286 	else if (*this==_L("EOpNotEqual")) return EOpNotEqual;
       
   287 	else if (*this==_L("EOpGreaterThan")) return EOpGreaterThan;
       
   288 	else if (*this==_L("EOpLessThan")) return EOpLessThan;
       
   289 	else if (*this==_L("EOpGreaterThanOrEqual")) return EOpGreaterThanOrEqual;
       
   290 	else if (*this==_L("EOpLessThanOrEqual")) return EOpLessThanOrEqual;
       
   291 	else if (*this==_L("EOpAscendingSort")) return EOpAscendingSort;
       
   292 	else if (*this==_L("EOpDescendingSort")) return EOpDescendingSort;	
       
   293 	
       
   294 	else if (*this==_L("ERuleValueInteger")) return ERuleValueInteger;
       
   295 	else if (*this==_L("ERuleValueDes8")) return ERuleValueDes8;
       
   296 	else if (*this==_L("ERuleValueDes16")) return ERuleValueDes16;
       
   297 	else if (*this==_L("ERuleValueBoolean")) return ERuleValueBoolean;
       
   298 	
       
   299 	else if (*this==_L("KMaxTInt")) return KMaxTInt;
       
   300 	else if (*this==_L("NULL")) return NULL;
       
   301 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
       
   302 	else if (*this==_L("KAlgorithmHashMd4")) return KAlgorithmHashMd4;
       
   303 	else if (*this==_L("KAlgorithmCipherAesXcbcMac96")) return KAlgorithmCipherAesXcbcMac96;
       
   304 	else if (*this==_L("KAlgorithmCipherAesXcbcPrf128")) return KAlgorithmCipherAesXcbcPrf128;
       
   305 	else if (*this==_L("KMacInterface")) return KMacInterface;
       
   306 	else if (*this==_L("KSymmetricCipherMode")) return KSymmetricCipherMode;
       
   307 	else if (*this==_L("KTestPlugin01Aes")) return KTestPlugin01Aes;
       
   308 	else if (*this==_L("KTestPlugin01XcbcMac96")) return KTestPlugin01XcbcMac96;
       
   309 	else if (*this==_L("KTestPlugin01MacMd2_1")) return KTestPlugin01MacMd2_1;
       
   310 	else if (*this==_L("KTestPlugin01MacMd2_2")) return KTestPlugin01MacMd2_2;
       
   311 	else if (*this==_L("KTestPlugin02Aes")) return KTestPlugin02Aes;
       
   312 	else if (*this==_L("KTestPlugin02XcbcMac96")) return KTestPlugin02XcbcMac96;
       
   313 	else if (*this==_L("KTestPlugin02XcbcPrf128")) return KTestPlugin02XcbcPrf128;
       
   314 #endif	
       
   315 	else
       
   316 		{
       
   317 		User::Panic(*this,KErrNotFound);
       
   318 		return 0;	
       
   319 		}	
       
   320 	}
       
   321 	
       
   322 TVariantPtrC::operator const TInt32*() 
       
   323 	{
       
   324 	
       
   325 	if (*this==_L("KHashOperationModes")) return KHashOperationModes;
       
   326 	else if (*this==_L("KDesCryptoModes")) return KDesCryptoModes;
       
   327 	else if (*this==_L("K3DesCryptoModes")) return K3DesCryptoModes;
       
   328 	else if (*this==_L("KAesCryptoModes")) return KAesCryptoModes;
       
   329 	else if (*this==_L("KRc2CryptoModes")) return KRc2CryptoModes;
       
   330 	else if (*this==_L("KArc4CryptoModes")) return KArc4CryptoModes;
       
   331 
       
   332 	else if (*this==_L("KDesPaddingModes")) return KDesPaddingModes;
       
   333 	else if (*this==_L("K3DesPaddingModes")) return K3DesPaddingModes;
       
   334 	else if (*this==_L("KAesPaddingModes")) return KAesPaddingModes;
       
   335 	else if (*this==_L("KRc2PaddingModes")) return KRc2PaddingModes;
       
   336 	else if (*this==_L("KArc4PaddingModes")) return KArc4PaddingModes;
       
   337 	else if (*this==_L("KRSACipherPaddingModes")) return KRSACipherPaddingModes;
       
   338 	else if (*this==_L("KRSASignerPaddingModes")) return KRSASignerPaddingModes;
       
   339 	else if (*this==_L("KDSASignerPaddingModes")) return KDSASignerPaddingModes;
       
   340 	else if (*this==_L("KRSAVerifierPaddingModes")) return KRSAVerifierPaddingModes;
       
   341 	else if (*this==_L("KDSAVerifierPaddingModes")) return KDSAVerifierPaddingModes;
       
   342 	
       
   343 	else
       
   344 		{
       
   345 		User::Panic(*this,KErrNotFound);
       
   346 		return 0;	
       
   347 		}
       
   348 	}
       
   349 	
       
   350 TVariantPtrC::operator TRomLitC16() 
       
   351 	{
       
   352 	
       
   353 	if (*this==_L("KSymbian")) return KSymbian;	
       
   354 	else if (*this==_L("KSymbianTestFramework")) return KSymbianTestFramework;
       
   355 	else if (*this==_L("KTestFramework")) return KTestFramework;
       
   356 	else if (*this==_L("KAlternativeName")) return KAlternativeName;
       
   357 	
       
   358 	else if (*this==_L("KMd2Description")) return KMd2Description;	
       
   359 	else if (*this==_L("KMd5Description")) return KMd5Description;
       
   360 	else if (*this==_L("KSha1Description")) return KSha1Description;
       
   361 	else if (*this==_L("KSha224Description")) return KSha224Description;
       
   362 	else if (*this==_L("KSha256Description")) return KSha256Description;
       
   363 	else if (*this==_L("KSha384Description")) return KSha384Description;
       
   364 	else if (*this==_L("KSha512Description")) return KSha512Description;
       
   365 	else if (*this==_L("KHmacMd2Description")) return KHmacMd2Description;
       
   366 	else if (*this==_L("KHmacMd5Description")) return KHmacMd5Description;	
       
   367 	else if (*this==_L("KHmacSha1Description")) return KHmacSha1Description;
       
   368 	else if (*this==_L("KHmacSha224Description")) return KHmacSha224Description;
       
   369 	else if (*this==_L("KHmacSha256Description")) return KHmacSha256Description;
       
   370 	else if (*this==_L("KHmacSha384Description")) return KHmacSha384Description;
       
   371 	else if (*this==_L("KHmacSha512Description")) return KHmacSha512Description;
       
   372 	else if (*this==_L("KRandomDescription")) return KRandomDescription;	
       
   373 	else if (*this==_L("KDesDescription")) return KDesDescription;
       
   374 	else if (*this==_L("K3DesDescription")) return K3DesDescription;	
       
   375 	else if (*this==_L("KAesDescription")) return KAesDescription;
       
   376 	else if (*this==_L("KRC2Description")) return KRC2Description;
       
   377 	else if (*this==_L("KARC4Description")) return KARC4Description;	
       
   378 	else if (*this==_L("KRsaCipherDescription")) return KRsaCipherDescription;
       
   379 	else if (*this==_L("KRsaSignerDescription")) return KRsaSignerDescription;	
       
   380 	else if (*this==_L("KDsaSignerDescription")) return KDsaSignerDescription;
       
   381 	else if (*this==_L("KRsaVerifierDescription")) return KRsaVerifierDescription;	
       
   382 	else if (*this==_L("KDsaVerifierDescription")) return KDsaVerifierDescription;
       
   383 	else if (*this==_L("KDHDescription")) return KDHDescription;	
       
   384 	else if (*this==_L("KSymmetricKeyGeneratorDescription")) return KSymmetricKeyGeneratorDescription;
       
   385 	else if (*this==_L("KKeyPairDescription")) return KKeyPairDescription;
       
   386 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
       
   387 	else if (*this==_L("KAesXcbcMac96Description")) return KAesXcbcMac96Description;
       
   388 	else if (*this==_L("KAesXcbcPrf128Description")) return KAesXcbcPrf128Description;
       
   389 #endif
       
   390 	else
       
   391 		{
       
   392 		User::Panic(*this,KErrNotFound);
       
   393 		return TRomLitC16();	
       
   394 		}
       
   395 	}
       
   396 	
       
   397 HBufC* TVariantPtrC::HexStringLC()
       
   398 	{
       
   399 	HBufC* parsedString = HBufC::NewLC(this->Length()*2);
       
   400 	TBuf<2> pair;
       
   401 	_LIT(KFormat2,"%02x"); 
       
   402 						    
       
   403    	for(TInt i = 0; i<this->Length() ; i++)
       
   404     	{
       
   405 		TInt num  = (*this)[i];
       
   406     	pair.Format(KFormat2,num);
       
   407     	parsedString->Des().Append(pair);
       
   408     	}
       
   409 	    
       
   410 	return parsedString;
       
   411 	}
       
   412