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