secureswitools/swisistools/source/sisxlibrary/sishash.h
changeset 0 ba25891c3a9e
child 26 04d4a7bbc3e0
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004-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 * Note: This file may contain code to generate corrupt files for test purposes.
       
    16 * Such code is excluded from production builds by use of compiler defines;
       
    17 * it is recommended that such code should be removed if this code is ever published publicly.
       
    18 * As specified in SGL.GT0188.251
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 /**
       
    24  @file 
       
    25  @internalComponent
       
    26  @released
       
    27 */
       
    28 
       
    29 #ifndef __SISHASH_H__
       
    30 #define __SISHASH_H__
       
    31 
       
    32 
       
    33 #include "structure.h"
       
    34 #include "numeric.h"
       
    35 #include "sisblob.h"
       
    36 #include "sisfiledata.h"
       
    37 
       
    38 class CSISHash : public CStructure <CSISFieldRoot::ESISHash>
       
    39 
       
    40 	{
       
    41 public:
       
    42 	typedef enum
       
    43 		{
       
    44 		EHashNone,
       
    45 		EHashSHA,
       
    46 		EHashIllegal
       
    47 		} 
       
    48 	TSISHash;
       
    49 
       
    50 private:
       
    51 	void InsertMembers ();
       
    52 
       
    53 public:
       
    54 	CSISHash ();
       
    55 	CSISHash (const CSISHash& aInitialiser);
       
    56 
       
    57 	virtual void operator=(const CSISHash& aHash);
       
    58 	virtual void Verify (const TUint32 aLanguages) const;
       
    59 	virtual std::string Name () const;
       
    60 
       
    61 	void SetHash(const TUint8* aHash, TUint32 aHashSize);
       
    62 	bool VerifyAlgorithm () const;
       
    63 	const CSISBlob& Blob() const;
       
    64 	void AddPackageEntry(std::wostream& aStream, bool aVerbose) const;
       
    65 
       
    66 private:
       
    67 	CSISUInt32	iAlgorithm;
       
    68 	CSISBlob	iBlob;
       
    69 
       
    70 	};
       
    71 
       
    72 
       
    73 inline void CSISHash::InsertMembers ()
       
    74 	{
       
    75 	InsertMember (iAlgorithm);
       
    76 	InsertMember (iBlob);
       
    77 	}
       
    78 
       
    79 
       
    80 inline CSISHash::CSISHash () :
       
    81 		iAlgorithm (EHashSHA)
       
    82 	{
       
    83 	InsertMembers (); 
       
    84 	}
       
    85 
       
    86 inline const CSISBlob& CSISHash::Blob() const
       
    87 	{
       
    88 	return (CSISBlob&)iBlob;
       
    89 	}
       
    90 
       
    91 
       
    92 #endif // __SISHASH_H__
       
    93