sl@0: /* sl@0: * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * ** IMPORTANT ** PublishedPartner API's in this file are published to 3rd party developers via the sl@0: * Symbian website. Changes to these API's should be treated as PublishedAll API changes and the Security TA should be consulted. sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: sl@0: #ifndef __PBE_H__ sl@0: #define __PBE_H__ sl@0: sl@0: #include sl@0: #include "pbebase.h" sl@0: sl@0: class CPBEncryptionData; sl@0: class CPBEncryptor; sl@0: class CPBDecryptor; sl@0: sl@0: /** sl@0: * Password Based Encryption ciphers. sl@0: * sl@0: * Note that RC2 has an additional key parameter, the "effective key length". sl@0: * sl@0: * Used in the construction of CPBEncryptElement, CPBEncryptSet, CPBEncryptParms, sl@0: * and CPBEncryptionData objects and in the CPBEncryptParms::Cipher() function. sl@0: */ sl@0: enum TPBECipher sl@0: { sl@0: /** AES cipher in CBC mode with a supplied key size of 128 bits. */ sl@0: ECipherAES_CBC_128, sl@0: /** AES cipher in CBC mode with a supplied key size of 192 bits. */ sl@0: ECipherAES_CBC_192, sl@0: /** AES cipher in CBC mode with a supplied key size of 256 bits. */ sl@0: ECipherAES_CBC_256, sl@0: /** DES cipher in CBC mode (with a supplied key size of 56 bits). */ sl@0: ECipherDES_CBC, sl@0: /** Triple-DES cipher in CBC mode. */ sl@0: ECipher3DES_CBC, sl@0: /** sl@0: * RC2 cipher in CBC mode with a supplied key length of 40 bits. sl@0: * sl@0: * It has an effective key length of 1024 bits (128 bytes), which is compatible sl@0: * with OpenSSL RC2 encryption. sl@0: */ sl@0: ECipherRC2_CBC_40, sl@0: /** sl@0: * RC2 cipher in CBC mode with a supplied key length of 128 bits. sl@0: * sl@0: * It has an effective key length of 1024 bits (128 bytes), which is compatible sl@0: * with OpenSSL RC2 encryption. sl@0: */ sl@0: ECipherRC2_CBC_128, sl@0: /** sl@0: * RC2 cipher in CBC mode with a supplied key length of 40 bits. sl@0: * sl@0: * It has an effective key length of 128 bits (16 bytes), which is compatible sl@0: * with the RC2 encryption used in PKCS#8 encryption keys generated by OpenSSL sl@0: */ sl@0: ECipherRC2_CBC_40_16, sl@0: /** sl@0: * RC2 cipher in CBC mode with a supplied key length of 128 bits. sl@0: * sl@0: * It has an effective key length of 128 bits (16 bytes), which is compatible sl@0: * with the RC2 encryption used in PKCS#8 encryption keys generated by OpenSSL sl@0: */ sl@0: ECipherRC2_CBC_128_16, sl@0: /** sl@0: * ARC4 cipher with a supplied key length of 128 bits. sl@0: * PKCS#12 PBE encryption algorithm sl@0: */ sl@0: ECipherARC4_128, sl@0: /** sl@0: * ARC4 cipher with a supplied key length of 40 bits. sl@0: * PKCS#12 PBE encryption algorithm sl@0: */ sl@0: ECipherARC4_40, sl@0: /** sl@0: * 2_KeyTriple-DES cipher in CBC mode. sl@0: * PKCS#12 PBE encryption algorithm sl@0: */ sl@0: ECipher2Key3DES_CBC, sl@0: /** sl@0: * RC2 Cipher in CBC mode with a supplied & effective key length of 40 bits. sl@0: * PKCS#12 PBE encryption algorithm sl@0: */ sl@0: ECipherRC2_CBC_40_5, sl@0: }; sl@0: sl@0: /** sl@0: * Allows the password based encryption and decryption of elements. sl@0: * Contains the encryption key and its associated encryption data. sl@0: * See the Cryptography api-guide documentation for more information sl@0: * and sample code. sl@0: */ sl@0: class CPBEncryptElement : public CPBEncryptionBase sl@0: { sl@0: public: sl@0: /** sl@0: * Creates a new CPBEncryptElement object for encryption of new data. sl@0: * sl@0: * If strong cryptography is present, a 128 bit AES cipher is used; sl@0: * otherwise, for weak cryptography, a 56 bit DES cipher is used. sl@0: * sl@0: * The symmetric key is derived from the password and a random salt using TPKCS5KDF::DeriveKeyL(). sl@0: * sl@0: * @param aPassword The user supplied password sl@0: * @return The new CPBEncryptElement object sl@0: */ sl@0: IMPORT_C static CPBEncryptElement* NewL(const TPBPassword& aPassword); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptElement object for encryption of new data. sl@0: * sl@0: * If strong cryptography is present, a 128 bit AES cipher is used; sl@0: * otherwise, for weak cryptography, a 56 bit DES cipher is used. sl@0: * sl@0: * The symmetric key is derived from the password and a random salt using TPKCS5KDF::DeriveKeyL(). sl@0: * sl@0: * A pointer to the returned object is put onto the cleanup stack. sl@0: * sl@0: * @param aPassword The user supplied password sl@0: * @return The new CPBEncryptElement object sl@0: */ sl@0: IMPORT_C static CPBEncryptElement* NewLC(const TPBPassword& aPassword); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptElement object for encryption of new data. sl@0: * sl@0: * The symmetric key is derived from the password and a random salt using TPKCS5KDF::DeriveKeyL(). sl@0: * sl@0: * @param aPassword The user supplied password sl@0: * @param aCipher The cipher to use sl@0: * @return The new CPBEncryptElement object sl@0: */ sl@0: IMPORT_C static CPBEncryptElement* NewL(const TPBPassword& aPassword, sl@0: TPBECipher aCipher); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptElement object for encryption of new data. sl@0: * sl@0: * The symmetric key is derived from the password and a random salt using TPKCS5KDF::DeriveKeyL(). sl@0: * sl@0: * A pointer to the returned object is put onto the cleanup stack. sl@0: * sl@0: * @param aPassword The user supplied password sl@0: * @param aCipher The cipher to use sl@0: * @return The new CPBEncryptElement object sl@0: */ sl@0: IMPORT_C static CPBEncryptElement* NewLC(const TPBPassword& aPassword, sl@0: TPBECipher aCipher); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptElement object for encryption of new data. sl@0: * sl@0: * The symmetric key is derived from the password using TPKCS5KDF::DeriveKeyL(). sl@0: * sl@0: * @param aPassword The user supplied password sl@0: * @param aParms An encryption parameter object comprising the cipher, sl@0: * salt, IV, and iteration count value. sl@0: * @return The new CPBEncryptElement object sl@0: */ sl@0: IMPORT_C static CPBEncryptElement* NewL(const TPBPassword& aPassword, sl@0: const CPBEncryptParms& aParms); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptElement object for encryption of new data. sl@0: * sl@0: * The symmetric key is derived from the password using TPKCS5KDF::DeriveKeyL(). sl@0: * sl@0: * A pointer to the returned object is put onto the cleanup stack. sl@0: * sl@0: * @param aPassword The user supplied password sl@0: * @param aParms An encryption parameter object comprising the cipher, sl@0: * salt, IV, and iteration count value. sl@0: * @return The new CPBEncryptElement object sl@0: */ sl@0: IMPORT_C static CPBEncryptElement* NewLC(const TPBPassword& aPassword, sl@0: const CPBEncryptParms& aParms); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptElement object for decryption of existing data. sl@0: * sl@0: * If the specified password is valid, the function regenerates the encryption key; sl@0: * otherwise, it leaves with KErrBadPassphrase. sl@0: * sl@0: * @param aData The encryption data object sl@0: * @param aPassword The user supplied password sl@0: * @return The new CPBEncryptElement object sl@0: * @leave KErrBadPassphrase If the specified password is incorrect sl@0: */ sl@0: IMPORT_C static CPBEncryptElement* NewL(const CPBEncryptionData& aData, sl@0: const TPBPassword& aPassword); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptElement object for decryption of existing data. sl@0: * sl@0: * If the specified password is valid, the function regenerates the encryption key; sl@0: * otherwise, it leaves with KErrBadPassphrase. sl@0: * sl@0: * A pointer to the returned object is put onto the cleanup stack. sl@0: * sl@0: * @param aData The encryption data object sl@0: * @param aPassword The user supplied password sl@0: * @return The new CPBEncryptElement object sl@0: * @leave KErrBadPassphrase If the specified password is incorrect sl@0: */ sl@0: IMPORT_C static CPBEncryptElement* NewLC(const CPBEncryptionData& aData, sl@0: const TPBPassword& aPassword); sl@0: sl@0: /** sl@0: * Gets the parameters allowing one to re-create the object with the sl@0: * same state at another point in the future. sl@0: * sl@0: * In order to decrypt any information previously encrypted with this object, sl@0: * you must store this encryption data along with it. Failure sl@0: * to do this will result in the permanent loss of the encrypted information. sl@0: * sl@0: * @return The data allowing one to re-create this object at a later time. sl@0: */ sl@0: const CPBEncryptionData& EncryptionData(void) const; sl@0: sl@0: /** sl@0: * Constructs a CPBEncryptor object allowing the encryption of data. sl@0: * sl@0: * @return A pointer to a CPBEncryptor object. sl@0: * The caller assumes ownership of the returned object. sl@0: */ sl@0: CPBEncryptor* NewEncryptL(void) const; sl@0: sl@0: /** sl@0: * Constructs a CPBEncryptor object allowing the encryption of data. sl@0: * sl@0: * @return A pointer to a CPBEncryptor object. sl@0: * The caller assumes ownership of the returned object. sl@0: * The returned pointer is left on the cleanup stack. sl@0: */ sl@0: CPBEncryptor* NewEncryptLC(void) const; sl@0: sl@0: /** sl@0: * Constructs a CPBDecryptor object allowing the decryption of data. sl@0: * sl@0: * @return A pointer to a CPBDecryptor object. sl@0: * The caller assumes ownership of the returned object. sl@0: */ sl@0: CPBDecryptor* NewDecryptL(void) const; sl@0: sl@0: /** sl@0: * Constructs a CPBDecryptor object allowing the decryption of data. sl@0: * sl@0: * @return A pointer to a CPBDecryptor object. sl@0: * The caller assumes ownership of the returned object. sl@0: * The returned pointer is left on the cleanup stack. sl@0: */ sl@0: CPBDecryptor* NewDecryptLC(void) const; sl@0: sl@0: /** sl@0: * Gets the maximum output ciphertext length given a specified input plaintext length. sl@0: * sl@0: * @param aPlaintextLength The plaintext length sl@0: * @return The maximum ciphertext length given a plaintext length. sl@0: */ sl@0: TInt MaxCiphertextLength(TInt aPlaintextLength) const; sl@0: sl@0: /** sl@0: * Gets the maximum output plaintext length given a specified input ciphertext length. sl@0: * sl@0: * @param aCiphertextLength The ciphertext length sl@0: * @return The maximum plaintext length given a ciphertext length. sl@0: */ sl@0: TInt MaxPlaintextLength(TInt aCiphertextLength) const; sl@0: sl@0: /** Destructor */ sl@0: virtual ~CPBEncryptElement(void); sl@0: protected: sl@0: /** @internalAll */ sl@0: void ConstructL(const TDesC8& aPassword); sl@0: /** @internalAll */ sl@0: void ConstructL(const TDesC8& aPassword, const TPBECipher aCipher); sl@0: /** @internalAll */ sl@0: void ConstructL(const TDesC8& aPassword, const CPBEncryptParms& aParms); sl@0: /** @internalAll */ sl@0: void ConstructL(const CPBEncryptionData& aData, const TPBPassword& aPassword); sl@0: /** @internalAll */ sl@0: TBool AuthenticateL(const TPBPassword& aPassword); sl@0: /** @internalAll */ sl@0: void MakeEncryptKeyL(TUint aKeySize, const TDesC8& aPassword); sl@0: /** @internalAll */ sl@0: CPBEncryptElement(void); sl@0: protected: sl@0: /** The encryption data */ sl@0: CPBEncryptionData* iData; sl@0: /** The derived encryption key */ sl@0: HBufC8* iEncryptKey; sl@0: private: sl@0: CPBEncryptElement(const CPBEncryptElement&); sl@0: CPBEncryptElement& operator= (const CPBEncryptElement&); sl@0: }; sl@0: sl@0: /** sl@0: * Derived class to allow the efficient password based encryption and sl@0: * decryption of multiple elements. sl@0: * sl@0: * This is useful if one wants random access to an encrypted source consisting sl@0: * of multiple independent elements, for example, a database or a store. sl@0: * sl@0: * Since it is unreasonable to force the decryption of an entire set to allow sl@0: * access to just a tiny portion of it, and since it is too costly to derive separate sl@0: * keys for each element within the set, a single randomly generated master sl@0: * key is used. This master key is encrypted with the password provided by the sl@0: * user of the class. Known plaintext attacks against the ciphertext are prevented sl@0: * by using a randomly chosen Initialisation Vector (IV) for each element. sl@0: * sl@0: * Contains the master encryption key. sl@0: * sl@0: * See the Cryptography api-guide documentation for more information and sample code. sl@0: * sl@0: * @see CPBEncryptElement sl@0: * sl@0: * @since v8.0 sl@0: */ sl@0: class CPBEncryptSet : public CPBEncryptElement sl@0: { sl@0: public: sl@0: /** sl@0: * Creates a new CPBEncryptSet object for encryption of new data sl@0: * (and generates an encrypted master key). sl@0: * sl@0: * If strong cryptography is present, a 128 bit AES cipher is used; sl@0: * otherwise, for weak cryptography, a 56 bit DES cipher is used. sl@0: * sl@0: * The symmetric key is derived from the password and a random salt using TPKCS5KDF::DeriveKeyL(). sl@0: * sl@0: * @param aPassword The users password. sl@0: * @return A new CPBEncryptSet object sl@0: */ sl@0: IMPORT_C static CPBEncryptSet* NewL(const TPBPassword& aPassword); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptSet object for encryption of new data sl@0: * (and generates an encrypted master key). sl@0: * sl@0: * The returned pointer is put onto the cleanup stack. sl@0: * sl@0: * If strong cryptography is present, a 128 bit AES cipher is used; sl@0: * otherwise, for weak cryptography, a 56 bit DES cipher is used. sl@0: * sl@0: * The symmetric key is derived from the password and a random salt using TPKCS5KDF::DeriveKeyL(). sl@0: * sl@0: * @param aPassword The user supplied password sl@0: * @return The new CPBEncryptSet object sl@0: */ sl@0: IMPORT_C static CPBEncryptSet* NewLC(const TPBPassword& aPassword); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptSet object for encryption of new data sl@0: * (and generates an encrypted master key). sl@0: * sl@0: * The symmetric key is derived from the password and a random salt using TPKCS5KDF::DeriveKeyL(). sl@0: * sl@0: * @param aPassword The user supplied password sl@0: * @param aCipher The cipher to use sl@0: * @return The new CPBEncryptSet object sl@0: */ sl@0: IMPORT_C static CPBEncryptSet* NewL(const TPBPassword& aPassword, sl@0: TPBECipher aCipher); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptSet object for encryption of new data sl@0: * (and generates an encrypted master key). sl@0: * sl@0: * The returned pointer is put onto the cleanup stack. sl@0: * sl@0: * The symmetric key is derived from the password and a random salt using TPKCS5KDF::DeriveKeyL(). sl@0: * sl@0: * @param aPassword The user supplied password sl@0: * @param aCipher The cipher to use sl@0: * @return The new CPBEncryptSet object sl@0: */ sl@0: IMPORT_C static CPBEncryptSet* NewLC(const TPBPassword& aPassword, sl@0: TPBECipher aCipher); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptSet object for encryption of new data sl@0: * (and generates an encrypted master key). sl@0: * sl@0: * The symmetric key is derived from the password using TPKCS5KDF::DeriveKeyL(). sl@0: * sl@0: * @param aPassword The user supplied password sl@0: * @param aParms An encryption parameter object comprising the cipher, sl@0: * salt, IV, and iteration count value. sl@0: * @return The new CPBEncryptSet object sl@0: */ sl@0: IMPORT_C static CPBEncryptSet* NewL(const TPBPassword& aPassword, sl@0: const CPBEncryptParms& aParms); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptSet object for encryption of new data sl@0: * (and generates an encrypted master key). sl@0: * sl@0: * The returned pointer is put onto the cleanup stack. sl@0: * sl@0: * The symmetric key is derived from the password using TPKCS5KDF::DeriveKeyL(). sl@0: * sl@0: * @param aPassword The user supplied password sl@0: * @param aParms An encryption parameter object comprising the cipher, sl@0: * salt, IV, and iteration count value. sl@0: * @return The new CPBEncryptSet object sl@0: */ sl@0: IMPORT_C static CPBEncryptSet* NewLC(const TPBPassword& aPassword, sl@0: const CPBEncryptParms& aParms); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptSet object for encryption of new data sl@0: * (and generates an encrypted master key). sl@0: * sl@0: * If the specified password is valid, the function regenerates the encryption key; sl@0: * otherwise, it leaves with KErrBadPassphrase. sl@0: * sl@0: * @param aData The encryption data object to copy sl@0: * @param aEncryptedMasterKey On return, the encrypted master key sl@0: * @param aPassword The user supplied password sl@0: * @return The new CPBEncryptSet object sl@0: * @leave KErrBadPassphrase If the specified password is incorrect sl@0: */ sl@0: IMPORT_C static CPBEncryptSet* NewL(const CPBEncryptionData& aData, sl@0: const TDesC8& aEncryptedMasterKey, const TPBPassword& aPassword); sl@0: sl@0: /** sl@0: * Creates a new CPBEncryptSet object for encryption of new data sl@0: * (and generates an encrypted master key). sl@0: * sl@0: * The returned pointer is put onto the cleanup stack. sl@0: * sl@0: * If the specified password is valid, the function regenerates the encryption key; sl@0: * otherwise, it leaves with KErrBadPassphrase. sl@0: * sl@0: * @param aData The encryption data object to copy sl@0: * @param aEncryptedMasterKey On return, the encrypted master key sl@0: * @param aPassword The user supplied password sl@0: * @return The new CPBEncryptSet object sl@0: * @leave KErrBadPassphrase If the specified password is incorrect sl@0: */ sl@0: IMPORT_C static CPBEncryptSet* NewLC(const CPBEncryptionData& aData, sl@0: const TDesC8& aEncryptedMasterKey, const TPBPassword& aPassword); sl@0: sl@0: /** sl@0: * Gets the encrypted form of the master key. sl@0: * sl@0: * This must be stored along with the object returned by CPBEncryptElement::EncryptionData() sl@0: * in order for the object to be reconstructed with the same state at sl@0: * some time in the future. Failure to do so will result in the permanent sl@0: * loss of any information encrypted with this object. sl@0: * sl@0: * @return The encrypted master key. sl@0: */ sl@0: IMPORT_C const TDesC8& EncryptedMasterKey(void) const; sl@0: sl@0: /** sl@0: * Constructs a CPBEncryptor object based on the state of this object sl@0: * (i.e., the cipher and master key) allowing the encryption of data. sl@0: * sl@0: * @return A pointer to a CPBEncryptor object. sl@0: * The caller assumes ownership of the returned object. sl@0: */ sl@0: CPBEncryptor* NewEncryptL(void) const; sl@0: sl@0: /** sl@0: * Constructs a CPBEncryptor object based on the state of this object sl@0: * (i.e., the cipher and master key) allowing the encryption of data. sl@0: * sl@0: * @return A pointer to a CPBEncryptor object. sl@0: * The caller assumes ownership of the returned object. sl@0: * The returned pointer is left on the cleanup stack. sl@0: */ sl@0: CPBEncryptor* NewEncryptLC(void) const; sl@0: sl@0: /** sl@0: * Constructs a CPBDecryptor object based on the state of this object sl@0: * (i.e., the cipher and master key) allowing the decryption of data. sl@0: * sl@0: * @return A pointer to a CPBDecryptor object. sl@0: * The caller assumes ownership of the returned object. sl@0: */ sl@0: CPBDecryptor* NewDecryptL(void) const; sl@0: sl@0: /** sl@0: * Constructs a CPBDecryptor object based on the state of this object sl@0: * (i.e., the cipher and master key) allowing the decryption of data. sl@0: * sl@0: * @return A pointer to a CPBDecryptor object. sl@0: * The caller assumes ownership of the returned object. sl@0: * The returned pointer is left on the cleanup stack. sl@0: */ sl@0: CPBDecryptor* NewDecryptLC(void) const; sl@0: sl@0: /** sl@0: * Re-encrypts the master key with the specified new password. sl@0: * sl@0: * @param aNewPassword The new password sl@0: */ sl@0: IMPORT_C void ChangePasswordL(const TPBPassword& aNewPassword); sl@0: sl@0: /** sl@0: * Gets the maximum output ciphertext length given a specified input plaintext length. sl@0: * sl@0: * @param aPlaintextLength The plaintext length sl@0: * @return The maximum ciphertext length given a plaintext length. sl@0: */ sl@0: TInt MaxCiphertextLength(TInt aPlaintextLength) const; sl@0: sl@0: /** sl@0: * Gets the maximum output plaintext length given a specified input ciphertext length. sl@0: * sl@0: * @param aCiphertextLength The ciphertext length sl@0: * @return The maximum plaintext length given a ciphertext length. sl@0: */ sl@0: TInt MaxPlaintextLength(TInt aCiphertextLength) const; sl@0: sl@0: /** Destructor */ sl@0: virtual ~CPBEncryptSet(void); sl@0: protected: sl@0: /** @internalAll */ sl@0: void ConstructL(const TDesC8& aPassword); sl@0: /** @internalAll */ sl@0: void ConstructL(const TDesC8& aPassword, TPBECipher aCipher); sl@0: /** @internalAll */ sl@0: void ConstructL(const TDesC8& aPassword, const CPBEncryptParms& aParms); sl@0: /** @internalAll */ sl@0: void ConstructMasterKeyL(void); sl@0: /** @internalAll */ sl@0: void ConstructL(const CPBEncryptionData& aData, sl@0: const TDesC8& aEncryptedMasterKey, const TPBPassword& aPassword); sl@0: /** @internalAll */ sl@0: void DecryptMasterKeyL(TDes8& aMasterKey) const; sl@0: /** @internalAll */ sl@0: void EncryptMasterKeyL(const TDesC8& aMasterKey); sl@0: protected: sl@0: /** @internalAll */ sl@0: CPBEncryptSet(void); sl@0: /** The derived encrypted master key*/ sl@0: HBufC8* iEncryptedMasterKey; sl@0: private: sl@0: CPBEncryptSet(const CPBEncryptSet&); sl@0: CPBEncryptSet& operator= (const CPBEncryptSet&); sl@0: }; sl@0: sl@0: /** sl@0: * Class representing both 8 and 16 bit descriptor passwords. sl@0: * Internally these are stored as 8 bit passwords. sl@0: */ sl@0: class TPBPassword sl@0: { sl@0: public: sl@0: /** sl@0: * Sets the password. sl@0: * sl@0: * Constructs a TPBPassword object with an 8 bit descriptor. sl@0: * sl@0: * Internally this is represented as an octet byte sequence sl@0: * (aka 8 bit TPtrC8 descriptor). sl@0: * sl@0: * @param aPassword A const reference to an 8 bit descriptor. sl@0: * representing the users initial password. sl@0: */ sl@0: IMPORT_C TPBPassword(const TDesC8& aPassword); sl@0: sl@0: /** sl@0: * Sets the password. sl@0: * sl@0: * Constructs a TPBPassword object with a 16 bit descriptor. sl@0: * sl@0: * Internally this is represented as an octet byte sequence sl@0: * (aka 8 bit TPtrC8 descriptor). sl@0: * sl@0: * @param aPassword A const reference to a 16 bit descriptor sl@0: * representing the users initial password. sl@0: */ sl@0: IMPORT_C TPBPassword(const TDesC16& aPassword); sl@0: sl@0: /** sl@0: * Gets the password. sl@0: * sl@0: * Gets a const reference to an 8 bit descriptor representing the users sl@0: * initial password (which could have been either 8 or 16 bit). sl@0: * sl@0: * @return A const reference to an 8 bit descriptor. sl@0: */ sl@0: IMPORT_C const TDesC8& Password(void) const; sl@0: private: sl@0: TPtrC8 iPassword; sl@0: }; sl@0: sl@0: #endif