pkiutilities/PKCS12/CrPkcs12/Inc/pkcs12.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2004 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 "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:   Header file of the PKCS#12 parser API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CPKCS12_H__
       
    20 #define __CPKCS12_H__
       
    21 
       
    22 //  INCLUDES
       
    23 #include "mpkcs12.h"
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include <f32file.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CCrPKCS12;
       
    30 class CX509Certificate;
       
    31 class CCrData;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 *  Class CPKCS12
       
    37 *  The PKCS12 Library (CrPKCS12) provides opening functionality of a 
       
    38 *  PKCS #12 file. PKCS #12 is a format used to store and protect user's
       
    39 *  private data, i.e. his/her key pairs, certificates and other personal
       
    40 *  information.
       
    41 *
       
    42 *  @lib crpkcs12.lib
       
    43 *  @since Series 60 3.0
       
    44 */
       
    45 NONSHARABLE_CLASS( CPKCS12 ): public MPKCS12, public CBase
       
    46     {
       
    47     public:  // Constructors and destructor
       
    48         
       
    49         /**
       
    50         * Two-phased constructor.
       
    51         */
       
    52         static CPKCS12* NewL();
       
    53         
       
    54     private:
       
    55         /**
       
    56         * Destructor.
       
    57         */
       
    58         virtual ~CPKCS12();
       
    59 
       
    60     public: // Functions from MPKCS12
       
    61     
       
    62         TBool IsPKCS12Data(const TDesC8& aBinaryData);
       
    63 
       
    64         /**
       
    65         * Executes actual parsing.
       
    66         * @param aPKCS12 PKCS#12 encoded data
       
    67         * @param aPassword Used to generate encryption key.
       
    68         * @return ?description
       
    69         */        
       
    70         void ParseL(const TDesC8& aPKCS12, const TDesC16& aPassword);
       
    71         
       
    72         /**
       
    73         * ?member_description.
       
    74         * @since Series ?XX ?SeriesXX_version
       
    75         * @param ?arg1 ?description
       
    76         * @return ?description
       
    77         */
       
    78         const CArrayPtr<CX509Certificate>& CACertificates() const;
       
    79         const CArrayPtr<CX509Certificate>& UserCertificates() const;
       
    80         const CArrayPtr<HBufC8>& PrivateKeys() const;
       
    81         
       
    82         // Returns number of SafeBags in PKCS #12 file.
       
    83         TUint SafeBagsCount() const;
       
    84         // Returns the number of iterations.
       
    85 		TUint IterCount() const;
       
    86         
       
    87         /**
       
    88 	    * Frees resources of the class
       
    89 	    */
       
    90         void Release();                
       
    91 
       
    92     private:
       
    93 
       
    94         /**
       
    95         * C++ default constructor.
       
    96         */
       
    97         CPKCS12();
       
    98 
       
    99         /**
       
   100         * By default Symbian 2nd phase constructor is private.
       
   101         */
       
   102         void ConstructL();
       
   103 
       
   104         void Reset();
       
   105                 
       
   106         void HandleErrorL( TUint16 aError ) const; 
       
   107         
       
   108         static TBool IsASN1Tag(TInt aTag, const TDesC8& aBinaryData, TInt& aPos);
       
   109         
       
   110         static TBool IsExpectedData(const TDesC8& aBinaryData, TInt& aPos, const TDesC8& aExpectedData);
       
   111 
       
   112     private:    // Data
       
   113         CCrPKCS12* iCrPkcs12;        
       
   114         CCrData* iCrData;                 
       
   115     };
       
   116 
       
   117 #endif      // __CPKCS12_H__   
       
   118             
       
   119 // End of File