secsrv_plat/cms_api/inc/CCMSCertificateChoices.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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCMSCertificateChoices_H
       
    21 #define CCMSCertificateChoices_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <asn1cons.h>
       
    26 #include "MCMSModule.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CCMSX509Certificate;
       
    30 class CCMSX509AttributeCertificate;
       
    31 
       
    32 // CONSTANTS
       
    33 const TTagType KCMSAttrCertTag = 1;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 /**
       
    37 *  CertificateChoices type module
       
    38 *
       
    39 *  ASN.1 definition:
       
    40 *       CertificateChoices ::= CHOICE {
       
    41 *         certificate Certificate,                 -- See X.509
       
    42 *         extendedCertificate [0] IMPLICIT ExtendedCertificate,
       
    43 *                                                  -- Obsolete
       
    44 *         attrCert [1] IMPLICIT AttributeCertificate }
       
    45 *                                                  -- See X.509 and X9.57
       
    46 * 
       
    47 *  @lib cms.lib
       
    48 *  @since 2.8
       
    49 */
       
    50 class CCMSCertificateChoices : public CBase, public MCMSModule
       
    51     {
       
    52 
       
    53     public:  // Constructors and destructor
       
    54 		/**
       
    55         * Two-phased constructor.
       
    56         */
       
    57         IMPORT_C static CCMSCertificateChoices* NewL();
       
    58 
       
    59 		/**
       
    60         * Two-phased constructor. Leaves a copy in cleanup stack.
       
    61         */
       
    62         IMPORT_C static CCMSCertificateChoices* NewLC();
       
    63 
       
    64         /**
       
    65         * Two-phased constructor. Copies of the parameters are made.
       
    66         *
       
    67         * @param aCertificate X.509 Certificate
       
    68         */
       
    69         IMPORT_C static CCMSCertificateChoices* NewL(
       
    70             const CCMSX509Certificate& aCertificate );
       
    71 
       
    72         /**
       
    73         * Two-phased constructor. Copies of the parameters are made.
       
    74         * Leaves a copy in cleanup stack.
       
    75         *
       
    76         * @param aCertificate X.509 Certificate
       
    77         */
       
    78         IMPORT_C static CCMSCertificateChoices* NewLC(
       
    79             const CCMSX509Certificate& aCertificate );
       
    80 
       
    81         /**
       
    82         * Two-phased constructor. Copies of the parameters are made.
       
    83         *
       
    84         * @param aSubjectKeyIdentifier X.509 subjectKeyIdentifier
       
    85         */
       
    86         IMPORT_C static CCMSCertificateChoices* NewL(
       
    87             const CCMSX509AttributeCertificate& aAttrCert );
       
    88 
       
    89         /**
       
    90         * Two-phased constructor. Copies of the parameters are made.
       
    91         * Leaves a copy in cleanup stack.
       
    92         *
       
    93         * @param aSubjectKeyIdentifier X.509 subjectKeyIdentifier
       
    94         */
       
    95         IMPORT_C static CCMSCertificateChoices* NewLC(
       
    96             const CCMSX509AttributeCertificate& aAttrCert );
       
    97 
       
    98         /**
       
    99         * Destructor.
       
   100         */
       
   101         virtual ~CCMSCertificateChoices();
       
   102 
       
   103     public: // New functions
       
   104 
       
   105         /**
       
   106         * Getter for certificate.
       
   107         * @since 2.8
       
   108         * @return Certificate or NULL
       
   109         */
       
   110 		IMPORT_C const CCMSX509Certificate* Certificate() const;
       
   111 
       
   112         /**
       
   113         * Getter for attrCert.
       
   114         * @since 2.8
       
   115         * @return attrCert or NULL
       
   116         */
       
   117 		IMPORT_C const CCMSX509AttributeCertificate* AttrCert() const;
       
   118 
       
   119 		/**
       
   120         * Setter for Certificate. Create a copy of the parameters.
       
   121         * @since 2.8
       
   122         * @param aCertificate X.509 Certificate
       
   123         */
       
   124 		IMPORT_C void SetCertificateL(
       
   125             const CCMSX509Certificate& aCertificate );
       
   126 
       
   127 		/**
       
   128         * Setter for attrCert. Create a copy of the parameters.
       
   129         * @since 2.8
       
   130         * @param aAttrCert X.509 AttributeCertificate
       
   131         */
       
   132 		IMPORT_C void SetAttrCertL(
       
   133             const CCMSX509AttributeCertificate& aAttrCert );
       
   134 
       
   135 
       
   136     public: // Functions from base classes
       
   137 
       
   138         /**
       
   139         * From MCMSModule
       
   140         * @since 2.8
       
   141         * @param aResult Allocates and sets result in this variable
       
   142         * @return ?description
       
   143         */
       
   144         void EncodeL( HBufC8*& aResult ) const;
       
   145         
       
   146 	 	/**
       
   147         * From MCMSModule
       
   148         * @since 2.8
       
   149         * @param aRawData raw-data to be parsed in this instance
       
   150         */
       
   151         void DecodeL( const TDesC8& aRawData );
       
   152 
       
   153 	 	/**
       
   154         * From MCMSModule
       
   155         * @since 2.8
       
   156         * @return Returns ASN1 encoder and leaves it in CleanupStack
       
   157         */
       
   158         CASN1EncBase* EncoderLC() const;
       
   159 
       
   160     protected:  // New functions
       
   161 
       
   162 	   /**
       
   163         * Protected construction to allow derivation
       
   164         */
       
   165         IMPORT_C void ConstructL(
       
   166             const CCMSX509Certificate& aCertificate );
       
   167 
       
   168         /**
       
   169         * Protected construction to allow derivation
       
   170         */
       
   171         IMPORT_C void ConstructL(
       
   172             const CCMSX509AttributeCertificate& aAttrCert );
       
   173 
       
   174         /**
       
   175         * C++ default constructor.
       
   176         */
       
   177         IMPORT_C CCMSCertificateChoices();
       
   178 
       
   179     private:    // Data
       
   180 
       
   181         // certificate value
       
   182         CCMSX509Certificate* iCertificate;
       
   183 
       
   184         // attrCert value
       
   185         CCMSX509AttributeCertificate* iAttrCert;
       
   186         
       
   187     };
       
   188 
       
   189 #endif      // CCMSCertificateChoices_H
       
   190 
       
   191 // End of File