os/security/cryptoservices/certificateandkeymgmt/tpkcs12intgrtn/inc/tpkcs12common.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2005-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 * This file contains the declaration of classe CPkcs12Parser to parse the PKCS12 data
    16 *
    17 */
    18 
    19 
    20 /**
    21  @file 
    22  @internalTechnology
    23 */
    24 #ifndef __TPKCS12COMMON_H
    25 #define __TPKCS12COMMON_H
    26 
    27 #include <pkcs12.h> 
    28 
    29 using namespace PKCS12;
    30 //System Include
    31 #include <e32base.h>
    32 #include <pkcs12bags.h>
    33 #include <pkcs12attribute.h>
    34 #include <pkcs12macdata.h>
    35 #include <asn1enc.h> 
    36 #include <asymmetrickeys.h>
    37 
    38 //user include
    39 #include "tpkcs12data.h"
    40 
    41 /**
    42  Contains methods to parse the PFX structure. 
    43 */
    44 class CPkcs12Parser : public CBase
    45 	{
    46 public:
    47 	
    48 	static CPkcs12Parser* NewL();
    49 		 
    50 	static CPkcs12Parser* NewLC();	 
    51 	
    52 	void SetIntegrityPasswordL(const TDesC& aIntegrityPassword);
    53  		
    54 	void SetPrivacyPassword(RPointerArray<TDesC>& aPrivacyPassword);
    55 			
    56 	void SetDataL(const TDesC& aDatapath);
    57 		
    58 	void ParseL();
    59 	/**  to get the reference to PfxHeader object*/
    60 	inline CPfxHeader& PfxHeader()  {return *iPkcs12Header;}
    61 	/**  to get the reference to array contains the pointers to CSafeContentBag objects*/
    62 	inline RPointerArray<CSafeContentBag>& ArraySafeContentBag()  {return iArraySafecontentBag;}
    63 	/**  to get the reference to array contains the pointers to CSafeBagData objects*/
    64 	inline RPointerArray<CSafeBagData>& ArraySafeBagData()  {return iArrayBagData;}
    65 
    66 	~CPkcs12Parser();	
    67 private:
    68 	
    69 	CPkcs12Parser();
    70 
    71 	CSafeBagData* CreateBagDataL(TInt aContentInfo, TInt aContentType );
    72 
    73 	void ParseSafeBagL(TInt aContentInfo , TInt aContentType ,CDecPkcs12SafeBag& aSafeBag);
    74 
    75 	void BagAttributesL(const CDecPkcs12SafeBag& aSafeBag  ,CSafeBagData& abagData) ;
    76 
    77 	void ParseKeyBag(CDecPkcs12KeyBag& aKeyBag , CSafeBagData& abagData);
    78 
    79 	void ParseShroudedKeyBagL(CDecPkcs12ShroudedKeyBag& aKeyBag , CSafeBagData& abagData , TInt aPassIndex);
    80 
    81 	void ParseCertBag(CDecPkcs12CertBag& aCertBag , CSafeBagData& abagData);
    82 
    83 	void ParseSafeContentBagL(CDecPkcs12SafeContentsBag& safeContentsBag, TInt aContentinfo , TInt aContentType ) ;
    84 
    85 
    86 					
    87 private:
    88 	/** Contains the pointers  to the safes bags in the PKCS12 PFX Structure*/
    89 	RPointerArray<CSafeBagData> iArrayBagData;	
    90 	/** Contains the safe content bag number and the number of bags in it */
    91 	RPointerArray<CSafeContentBag> iArraySafecontentBag ;
    92 	/** Contains the details of the PKCS12 PFX Structure*/
    93 	CPfxHeader* iPkcs12Header ;
    94 	/**contains the integritypassword of the PKCS#12 file */	
    95 	HBufC* iIntegrityPassword;
    96 	/**contains the privacy passwords of the PKCS#12 file */	
    97 	RPointerArray<TDesC>* iPrivacyPassword;
    98 	/**contains the PKCS#12 data */	
    99 	HBufC8*	iRawData;		
   100 		
   101 	/**store the safebag number */	
   102 	TInt iSafebagNumber ; 
   103 
   104 	};
   105 	
   106 #endif
   107