os/security/crypto/weakcryptospi/source/pbe/pbedata.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
sl@0
    20
#include "pkcs5kdf.h"
sl@0
    21
#include "pkcs12kdf.h"
sl@0
    22
#include "pbedata.h"
sl@0
    23
#include "pbesymmetricfactory.h"
sl@0
    24
#include "cryptostrength.h"
sl@0
    25
sl@0
    26
EXPORT_C CPBEncryptionData* CPBEncryptionData::NewL(const TDesC8& aPassword,
sl@0
    27
	TPBECipher aCipher, const TDesC8& aAuthSalt, 
sl@0
    28
	const TDesC8& aEncryptSalt, const TDesC8& aIV, TUint aIterations)
sl@0
    29
	{
sl@0
    30
	CPBEncryptionData* self = NewLC(aPassword, aCipher, aAuthSalt, aEncryptSalt,
sl@0
    31
		aIV, aIterations);
sl@0
    32
	CleanupStack::Pop(self);
sl@0
    33
	return self;
sl@0
    34
	}
sl@0
    35
sl@0
    36
EXPORT_C CPBEncryptionData* CPBEncryptionData::NewLC(const TDesC8& aPassword,
sl@0
    37
	TPBECipher aCipher, const TDesC8& aAuthSalt, 
sl@0
    38
	const TDesC8& aEncryptSalt, const TDesC8& aIV, TUint aIterations)
sl@0
    39
	{
sl@0
    40
	CPBEncryptionData* self = new(ELeave)CPBEncryptionData();
sl@0
    41
	CleanupStack::PushL(self);
sl@0
    42
	self->ConstructL(aPassword, aCipher, aAuthSalt, aEncryptSalt, aIV,
sl@0
    43
		aIterations);
sl@0
    44
	return self;
sl@0
    45
	}
sl@0
    46
sl@0
    47
EXPORT_C CPBEncryptionData* CPBEncryptionData::NewL(
sl@0
    48
	const CPBEncryptionData& aData)
sl@0
    49
	{
sl@0
    50
	CPBEncryptionData* self = NewLC(aData);
sl@0
    51
	CleanupStack::Pop(self);
sl@0
    52
	return self;
sl@0
    53
	}
sl@0
    54
sl@0
    55
EXPORT_C CPBEncryptionData* CPBEncryptionData::NewLC(
sl@0
    56
	const CPBEncryptionData& aData)
sl@0
    57
	{
sl@0
    58
	CPBEncryptionData* self = new(ELeave)CPBEncryptionData(); 
sl@0
    59
	CleanupStack::PushL(self);
sl@0
    60
	self->ConstructL(aData);
sl@0
    61
	return self;
sl@0
    62
	}
sl@0
    63
sl@0
    64
EXPORT_C CPBEncryptionData* CPBEncryptionData::NewL(
sl@0
    65
	const TDesC8& aPassword, const TDesC8& aAuthSalt,
sl@0
    66
	const CPBEncryptParms& aParms)
sl@0
    67
/**
sl@0
    68
	This factory function takes the user-supplied password
sl@0
    69
	and the randomly-generated authentication salt, along
sl@0
    70
	with the encryption paramaters.  It is provided so the
sl@0
    71
	encryption parameters can be extended without having to
sl@0
    72
	provide multiple factory functions.
sl@0
    73
sl@0
    74
	@param	aPassword		User-supplied password.  This
sl@0
    75
							password is not transformed so
sl@0
    76
							if it needs to be in a particular
sl@0
    77
							format, e.g. for PKCS#12, the
sl@0
    78
							transformation must be applied before
sl@0
    79
							this function is called.
sl@0
    80
	@param	aAuthSalt		The salt is used to derive the
sl@0
    81
							authentication key; not the encryption
sl@0
    82
							key.
sl@0
    83
	@param	aParms			Encryption parameters describe how the
sl@0
    84
							data is encrypted.
sl@0
    85
	@return					New instance of CPBEncryptionData.
sl@0
    86
 */
sl@0
    87
	{
sl@0
    88
	CPBEncryptionData* self = new(ELeave) CPBEncryptionData;
sl@0
    89
	CleanupStack::PushL(self);
sl@0
    90
	self->ConstructL(aPassword, aAuthSalt, aParms);
sl@0
    91
	CleanupStack::Pop(self);
sl@0
    92
	return self;
sl@0
    93
	}
sl@0
    94
sl@0
    95
void CPBEncryptionData::ConstructL(
sl@0
    96
	const TDesC8& aPassword, const TDesC8& aAuthSalt,
sl@0
    97
	const CPBEncryptParms& aParms)
sl@0
    98
/**
sl@0
    99
	Second-phase constructor for factory function with
sl@0
   100
	same signature.
sl@0
   101
 */
sl@0
   102
	{
sl@0
   103
	iParms = CPBEncryptParms::NewL(aParms);
sl@0
   104
	iAuth = CPBAuthData::NewL(
sl@0
   105
		aPassword,
sl@0
   106
		aAuthSalt,
sl@0
   107
		PBE::GetKeyBytes(aParms.Cipher()),
sl@0
   108
		aParms.Iterations());
sl@0
   109
	}
sl@0
   110
sl@0
   111
// HPRE-5TDFK2: Remove Store/estor.dll dependency on Cryptography/pbe.dll
sl@0
   112
// This method is DUPLICATED in common/generic/syslibs/store/ucrypt/ue_strm.cpp
sl@0
   113
EXPORT_C CPBEncryptionData::CPBEncryptionData(void)
sl@0
   114
	{
sl@0
   115
	}
sl@0
   116
sl@0
   117
// HPRE-5TDFK2: Remove Store/estor.dll dependency on Cryptography/pbe.dll
sl@0
   118
// This method is DUPLICATED in common/generic/syslibs/store/ucrypt/ue_strm.cpp
sl@0
   119
CPBEncryptionData::~CPBEncryptionData(void)
sl@0
   120
	{
sl@0
   121
	delete iParms;
sl@0
   122
	delete iAuth;
sl@0
   123
	}
sl@0
   124
sl@0
   125
void CPBEncryptionData::ConstructL(const TDesC8& aPassword,
sl@0
   126
	TPBECipher aCipher, const TDesC8& aAuthSalt, 
sl@0
   127
	const TDesC8& aEncryptSalt, const TDesC8& aIV, TUint aIterations)
sl@0
   128
	{
sl@0
   129
	iParms = CPBEncryptParms::NewL(aCipher, aEncryptSalt, aIV, aIterations);
sl@0
   130
	iAuth = CPBAuthData::NewL(aPassword, aAuthSalt,
sl@0
   131
		PBE::GetKeyBytes(aCipher), aIterations);
sl@0
   132
	}
sl@0
   133
sl@0
   134
void CPBEncryptionData::ConstructL(const CPBEncryptionData& aData)
sl@0
   135
	{
sl@0
   136
	iParms = CPBEncryptParms::NewL(aData.EncryptParms());
sl@0
   137
	iAuth = CPBAuthData::NewL(aData.AuthData());
sl@0
   138
	}
sl@0
   139
sl@0
   140
EXPORT_C const CPBEncryptParms& CPBEncryptionData::EncryptParms(void) const
sl@0
   141
	{
sl@0
   142
	return *iParms;
sl@0
   143
	} 
sl@0
   144
EXPORT_C const CPBAuthData& CPBEncryptionData::AuthData(void) const
sl@0
   145
	{
sl@0
   146
	return *iAuth;
sl@0
   147
	}
sl@0
   148
sl@0
   149
/* CPBEncryptParms */
sl@0
   150
EXPORT_C CPBEncryptParms* CPBEncryptParms::NewL()
sl@0
   151
/**
sl@0
   152
	This factory function allocates an encryption
sl@0
   153
	parameters object with default settings.  The
sl@0
   154
	individual settings can be retrieved and modified
sl@0
   155
	with the accessor and mutator functions after
sl@0
   156
	this object has been created.
sl@0
   157
sl@0
   158
	This factory function is provided so that individual
sl@0
   159
	parameters can be modified without providing many
sl@0
   160
	factory functions.
sl@0
   161
sl@0
   162
	@return					New instance of CPBEncryptParms.
sl@0
   163
 */
sl@0
   164
	{
sl@0
   165
	CPBEncryptParms* self = NewLC();
sl@0
   166
	CleanupStack::Pop(self);
sl@0
   167
	return self;
sl@0
   168
	}
sl@0
   169
sl@0
   170
EXPORT_C CPBEncryptParms* CPBEncryptParms::NewLC()
sl@0
   171
/**
sl@0
   172
	Similar to the NewL overload which takes no
sl@0
   173
	arguments, this function additionally puts the
sl@0
   174
	allocated instance of CPBEncryptParms on the
sl@0
   175
	cleanup stack.
sl@0
   176
sl@0
   177
	@return					New instance of CPBEncryptParms.
sl@0
   178
 */
sl@0
   179
	{
sl@0
   180
	CPBEncryptParms* self = new(ELeave) CPBEncryptParms;
sl@0
   181
	CleanupStack::PushL(self);
sl@0
   182
	self->ConstructL();
sl@0
   183
	return self;
sl@0
   184
	}
sl@0
   185
sl@0
   186
void CPBEncryptParms::ConstructL()
sl@0
   187
/**
sl@0
   188
	Initialize this object with default cipher, kdf (PKCS#5,)
sl@0
   189
	salt length, iteration count, and IV.
sl@0
   190
 */
sl@0
   191
	{
sl@0
   192
	iData = new(ELeave) TParamsData;
sl@0
   193
	iData->iKdf = EKdfPkcs5;
sl@0
   194
	
sl@0
   195
	iSalt = HBufC8::NewMaxL(KPBEDefaultSaltBytes);
sl@0
   196
	TPtr8 saltDes = iSalt->Des();
sl@0
   197
	TRandom::RandomL(saltDes);
sl@0
   198
	
sl@0
   199
	iIterations = KDefaultIterations;
sl@0
   200
	
sl@0
   201
	iIV = HBufC8::NewMaxL(KPBEMaxCipherIVBytes);
sl@0
   202
	
sl@0
   203
	SetCipher(
sl@0
   204
			(TCrypto::Strength() == TCrypto::EStrong)
sl@0
   205
		?	KPBEDefaultStrongCipher : KPBEDefaultWeakCipher );
sl@0
   206
	}
sl@0
   207
sl@0
   208
EXPORT_C CPBEncryptParms* CPBEncryptParms::NewL(TPBECipher aCipher,
sl@0
   209
	const TDesC8& aSalt, const TDesC8& aIV, TUint aIterations)
sl@0
   210
	{
sl@0
   211
	CPBEncryptParms* self = NewLC(aCipher, aSalt, aIV, aIterations);
sl@0
   212
	CleanupStack::Pop(self);
sl@0
   213
	return self;
sl@0
   214
	}
sl@0
   215
sl@0
   216
EXPORT_C CPBEncryptParms* CPBEncryptParms::NewLC(TPBECipher aCipher,
sl@0
   217
	const TDesC8& aSalt, const TDesC8& aIV, TUint aIterations) 
sl@0
   218
	{
sl@0
   219
	CPBEncryptParms* self = new(ELeave)CPBEncryptParms();
sl@0
   220
	CleanupStack::PushL(self);
sl@0
   221
	self->ConstructL(aCipher, aSalt, aIV, aIterations);
sl@0
   222
	return self;
sl@0
   223
	}
sl@0
   224
sl@0
   225
EXPORT_C CPBEncryptParms* CPBEncryptParms::NewL(const CPBEncryptParms& aParms)
sl@0
   226
	{
sl@0
   227
	CPBEncryptParms* self = NewLC(aParms);
sl@0
   228
	CleanupStack::Pop(self);
sl@0
   229
	return self;
sl@0
   230
	}
sl@0
   231
sl@0
   232
EXPORT_C CPBEncryptParms* CPBEncryptParms::NewLC(const CPBEncryptParms& aParms)
sl@0
   233
	{
sl@0
   234
	CPBEncryptParms* self = new(ELeave)CPBEncryptParms();
sl@0
   235
	CleanupStack::PushL(self);
sl@0
   236
	self->ConstructL(aParms);
sl@0
   237
	return self;
sl@0
   238
	}
sl@0
   239
sl@0
   240
// HPRE-5TDFK2: Remove Store/estor.dll dependency on Cryptography/pbe.dll
sl@0
   241
// This method is DUPLICATED in common/generic/syslibs/store/ucrypt/ue_strm.cpp
sl@0
   242
EXPORT_C CPBEncryptParms::CPBEncryptParms()
sl@0
   243
	{
sl@0
   244
	}
sl@0
   245
sl@0
   246
// HPRE-5TDFK2: Remove Store/estor.dll dependency on Cryptography/pbe.dll
sl@0
   247
// This method is DUPLICATED in common/generic/syslibs/store/ucrypt/ue_strm.cpp
sl@0
   248
CPBEncryptParms::~CPBEncryptParms()
sl@0
   249
	{
sl@0
   250
	delete iData;
sl@0
   251
	delete iSalt;
sl@0
   252
	delete iIV;	
sl@0
   253
	}
sl@0
   254
sl@0
   255
void CPBEncryptParms::ConstructL(TPBECipher aCipher, const TDesC8& aSalt,
sl@0
   256
	const TDesC8& aIV, TUint aIterations)
sl@0
   257
	{
sl@0
   258
	iData = new(ELeave) TParamsData;
sl@0
   259
	iData->iCipher = aCipher;
sl@0
   260
	iData->iKdf = EKdfPkcs5;
sl@0
   261
	iSalt = aSalt.AllocL();
sl@0
   262
	iIV = aIV.AllocL();
sl@0
   263
	iIterations = aIterations;
sl@0
   264
	}
sl@0
   265
sl@0
   266
void CPBEncryptParms::ConstructL(const CPBEncryptParms& aParms)
sl@0
   267
	{
sl@0
   268
	iData = new(ELeave) TParamsData;
sl@0
   269
	iData->iCipher = aParms.Cipher();
sl@0
   270
	iData->iKdf = aParms.iData->iKdf;
sl@0
   271
	iSalt = aParms.Salt().AllocL();
sl@0
   272
	iIterations = aParms.Iterations();
sl@0
   273
	iIV = aParms.IV().AllocL();
sl@0
   274
	}
sl@0
   275
sl@0
   276
EXPORT_C TPBECipher CPBEncryptParms::Cipher() const
sl@0
   277
	{
sl@0
   278
	return iData->iCipher;
sl@0
   279
	}
sl@0
   280
sl@0
   281
EXPORT_C void CPBEncryptParms::SetCipher(TPBECipher aCipher)
sl@0
   282
 /**
sl@0
   283
  *	Replace the current cipher.  This function resizes the
sl@0
   284
  *	IV and replaces its existing contents.
sl@0
   285
  *	
sl@0
   286
  *	@param aCipher	New cipher.
sl@0
   287
  * 
sl@0
   288
  * @deprecated		Use SetCipherL instead.
sl@0
   289
  * @see			SetCipherL
sl@0
   290
  */
sl@0
   291
	{
sl@0
   292
	TPtr8 ivDes = iIV->Des();
sl@0
   293
	ivDes.SetLength(PBE::GetBlockBytes(aCipher));
sl@0
   294
	TRandom::RandomL(ivDes);
sl@0
   295
	
sl@0
   296
	iData->iCipher = aCipher;
sl@0
   297
	}
sl@0
   298
sl@0
   299
EXPORT_C CPBEncryptParms::TKdf CPBEncryptParms::Kdf() const
sl@0
   300
/**
sl@0
   301
	Accessor function returns the key derivation function
sl@0
   302
	(KDF) specified by this object.
sl@0
   303
sl@0
   304
	@return					KDF specified by this object.
sl@0
   305
 */
sl@0
   306
	{
sl@0
   307
	return iData->iKdf;
sl@0
   308
	}
sl@0
   309
sl@0
   310
EXPORT_C void CPBEncryptParms::SetKdf(CPBEncryptParms::TKdf aKdf)
sl@0
   311
/**
sl@0
   312
	Replace the current key derivation function.
sl@0
   313
sl@0
   314
	@param	aKdf			Key derivation function.
sl@0
   315
 */
sl@0
   316
	{
sl@0
   317
	iData->iKdf = aKdf;
sl@0
   318
	}
sl@0
   319
sl@0
   320
EXPORT_C TPtrC8 CPBEncryptParms::Salt() const
sl@0
   321
	{
sl@0
   322
	return TPtrC8(*iSalt);
sl@0
   323
	}
sl@0
   324
sl@0
   325
EXPORT_C void CPBEncryptParms::ResizeSaltL(TInt aNewLen)
sl@0
   326
/**
sl@0
   327
	Resize the current salt and replace its contents.
sl@0
   328
sl@0
   329
	@param	aNewLen			New salt length.
sl@0
   330
 */
sl@0
   331
	{
sl@0
   332
	iSalt = iSalt->ReAllocL(aNewLen);
sl@0
   333
	TPtr8 saltDes = iSalt->Des();
sl@0
   334
	TRandom::RandomL(saltDes);
sl@0
   335
	}
sl@0
   336
sl@0
   337
EXPORT_C TInt CPBEncryptParms::Iterations() const
sl@0
   338
	{
sl@0
   339
	return iIterations;
sl@0
   340
	}
sl@0
   341
sl@0
   342
EXPORT_C void CPBEncryptParms::SetIterations(TInt aIterCount)
sl@0
   343
/**
sl@0
   344
	Replace the current iteration count with the supplied value.
sl@0
   345
	
sl@0
   346
	@param	aIterCount		Number of iterations to apply in
sl@0
   347
							the KDF.
sl@0
   348
 */
sl@0
   349
	{
sl@0
   350
	ASSERT(aIterCount >= 0);
sl@0
   351
	iIterations = aIterCount;
sl@0
   352
	}
sl@0
   353
sl@0
   354
EXPORT_C TPtrC8 CPBEncryptParms::IV() const
sl@0
   355
	{
sl@0
   356
	return TPtrC8(*iIV);
sl@0
   357
	}
sl@0
   358
sl@0
   359
EXPORT_C void CPBEncryptParms::SetIV(const TDesC8& aNewIv)
sl@0
   360
/**
sl@0
   361
	Replace the initialization vector.
sl@0
   362
	
sl@0
   363
	@param	aNewIv			New initialization vector length.
sl@0
   364
							This must have no more than
sl@0
   365
							KPBEMaxCipherIVBytes bytes.
sl@0
   366
 */
sl@0
   367
	{
sl@0
   368
	iIV->Des().Copy(aNewIv);
sl@0
   369
	}
sl@0
   370
sl@0
   371
void CPBEncryptParms::DeriveKeyL(const TDesC8& aPassword, TDes8& aKeyBuf) const
sl@0
   372
/**
sl@0
   373
	Derive a key from this object's kdf, salt, amd iteration count.
sl@0
   374
	
sl@0
   375
	@param	aPassword		User-supplied password used to generate key.
sl@0
   376
	@param	aKeyBuf			Buffer to populate with new key.
sl@0
   377
							On entry it must be set to the required
sl@0
   378
							key length.
sl@0
   379
 */
sl@0
   380
	{
sl@0
   381
	switch (iData->iKdf)
sl@0
   382
		{
sl@0
   383
	case CPBEncryptParms::EKdfPkcs5:
sl@0
   384
		TPKCS5KDF::DeriveKeyL(aKeyBuf, aPassword, *iSalt, iIterations);
sl@0
   385
		break;
sl@0
   386
	
sl@0
   387
	case CPBEncryptParms::EKdfPkcs12:
sl@0
   388
		PKCS12KDF::DeriveKeyL(aKeyBuf, PKCS12KDF::EIDByteEncryptKey, aPassword, *iSalt, iIterations);
sl@0
   389
		break;
sl@0
   390
	
sl@0
   391
	default:
sl@0
   392
		ASSERT(EFalse);
sl@0
   393
		break;
sl@0
   394
		}
sl@0
   395
	}
sl@0
   396
sl@0
   397
/* CPBAuthData */
sl@0
   398
sl@0
   399
EXPORT_C CPBAuthData* CPBAuthData::NewL(const TDesC8& aPassword,
sl@0
   400
	const TDesC8& aSalt, TUint aKeySize, TUint aIterations)
sl@0
   401
	{
sl@0
   402
	CPBAuthData* self = NewLC(aPassword, aSalt, aKeySize, aIterations);
sl@0
   403
	CleanupStack::Pop(self);
sl@0
   404
	return self;
sl@0
   405
	}
sl@0
   406
sl@0
   407
EXPORT_C CPBAuthData* CPBAuthData::NewLC(const TDesC8& aPassword,
sl@0
   408
	const TDesC8& aSalt, TUint aKeySize, TUint aIterations) 
sl@0
   409
	{
sl@0
   410
	CPBAuthData* self = new(ELeave)CPBAuthData();
sl@0
   411
	CleanupStack::PushL(self);
sl@0
   412
	self->ConstructL(aPassword, aSalt, aKeySize, aIterations);
sl@0
   413
	return self;
sl@0
   414
	}
sl@0
   415
sl@0
   416
EXPORT_C CPBAuthData* CPBAuthData::NewL(const CPBAuthData& aData)
sl@0
   417
	{
sl@0
   418
	CPBAuthData* self = NewLC(aData);
sl@0
   419
	CleanupStack::Pop(self);
sl@0
   420
	return self;
sl@0
   421
	}
sl@0
   422
sl@0
   423
EXPORT_C CPBAuthData* CPBAuthData::NewLC(const CPBAuthData& aData)
sl@0
   424
	{
sl@0
   425
	CPBAuthData* self = new(ELeave)CPBAuthData();
sl@0
   426
	CleanupStack::PushL(self);
sl@0
   427
	self->ConstructL(aData);
sl@0
   428
	return self;
sl@0
   429
	}
sl@0
   430
sl@0
   431
// HPRE-5TDFK2: Remove Store/estor.dll dependency on Cryptography/pbe.dll
sl@0
   432
// This method is DUPLICATED in common/generic/syslibs/store/ucrypt/ue_strm.cpp
sl@0
   433
EXPORT_C CPBAuthData::CPBAuthData()
sl@0
   434
	{
sl@0
   435
	}
sl@0
   436
sl@0
   437
// HPRE-5TDFK2: Remove Store/estor.dll dependency on Cryptography/pbe.dll
sl@0
   438
// This method is DUPLICATED in common/generic/syslibs/store/ucrypt/ue_strm.cpp
sl@0
   439
CPBAuthData::~CPBAuthData()
sl@0
   440
	{
sl@0
   441
	delete iAuthKey;
sl@0
   442
	delete iSalt;
sl@0
   443
	}
sl@0
   444
sl@0
   445
void CPBAuthData::ConstructL(const TDesC8& aPassword, const TDesC8& aSalt, 
sl@0
   446
	TUint aKeySize, TUint aIterations)
sl@0
   447
	{
sl@0
   448
	iSalt = aSalt.AllocL();
sl@0
   449
	iIterations = aIterations;
sl@0
   450
	iAuthKey = HBufC8::NewMaxL(aKeySize);
sl@0
   451
	TPtr8 authKeyPtr = iAuthKey->Des();
sl@0
   452
	TPKCS5KDF::DeriveKeyL(authKeyPtr, aPassword, *iSalt, iIterations);
sl@0
   453
	}
sl@0
   454
sl@0
   455
void CPBAuthData::ConstructL(const CPBAuthData& aData)
sl@0
   456
	{
sl@0
   457
	iAuthKey = aData.Key().AllocL();
sl@0
   458
	iSalt = aData.Salt().AllocL();
sl@0
   459
	iIterations = aData.Iterations();
sl@0
   460
	}
sl@0
   461
sl@0
   462
EXPORT_C TPtrC8 CPBAuthData::Key() const
sl@0
   463
	{
sl@0
   464
	return TPtrC8(*iAuthKey);
sl@0
   465
	}
sl@0
   466
sl@0
   467
EXPORT_C TPtrC8 CPBAuthData::Salt() const
sl@0
   468
	{
sl@0
   469
	return TPtrC8(*iSalt);
sl@0
   470
	}
sl@0
   471
sl@0
   472
EXPORT_C TInt CPBAuthData::Iterations() const
sl@0
   473
	{
sl@0
   474
	return iIterations;
sl@0
   475
	}
sl@0
   476
sl@0
   477
EXPORT_C TBool CPBAuthData::operator==(const CPBAuthData& aAuth) const
sl@0
   478
	{
sl@0
   479
	//if the key's are equal, the its true, as the other members are used in key derivation
sl@0
   480
	return (*iAuthKey == aAuth.Key());
sl@0
   481
	}
sl@0
   482