secsrv_plat/cms_api/inc/CCMSX509GeneralName.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:  X.509 General Name type
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCMSX509GeneralName_H
       
    21 #define CCMSX509GeneralName_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <asn1cons.h>
       
    26 #include "MCMSModule.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 // Extensions
       
    30 class MCMSX509GeneralNameExtension;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 /**
       
    34 *  X.509 GeneralName type module
       
    35 *
       
    36 *  ASN.1 definition:
       
    37 *  GeneralName ::= CHOICE {
       
    38 *    otherName                  [0]  INSTANCE OF OTHER-NAME,
       
    39 *    rfc822Name                 [1]  IA5String,
       
    40 *    dNSName                    [2]  IA5String,
       
    41 *    x400Address                [3]  ORAddress,
       
    42 *    directoryName              [4]  Name,
       
    43 *    ediPartyName               [5]  EDIPartyName,
       
    44 *    uniformResourceIdentifier  [6]  IA5String,
       
    45 *    iPAddress                  [7]  OCTET STRING,
       
    46 *    registeredID               [8]  OBJECT IDENTIFIER
       
    47 *  }
       
    48 *
       
    49 *
       
    50 *  @lib cms.lib
       
    51 *  @since 3.0
       
    52 */
       
    53 class CCMSX509GeneralName : public CBase, public MCMSModule
       
    54     {
       
    55 
       
    56     public:  // Constructors and destructor
       
    57 		/**
       
    58         * Two-phased constructor.
       
    59         */
       
    60         IMPORT_C static CCMSX509GeneralName* NewL();
       
    61 
       
    62         /**
       
    63         * Two-phased constructor. Copies of the parameters are made.
       
    64         *
       
    65         * @param aTag the type of the choice
       
    66         * @param aData The data in DER encoded format
       
    67         */
       
    68         IMPORT_C static CCMSX509GeneralName* NewL(
       
    69             const TTagType aTag,
       
    70             const TDesC8& aData );
       
    71 
       
    72         /**
       
    73         * Destructor.
       
    74         */
       
    75         virtual ~CCMSX509GeneralName();
       
    76 
       
    77     public: // New functions
       
    78 
       
    79         /**
       
    80         * Getter for the tag.
       
    81         * @since 3.0
       
    82         * @return TTagType
       
    83         */
       
    84 		IMPORT_C TTagType Tag() const;
       
    85 
       
    86         /**
       
    87         * Getter for the data
       
    88         * @since 3.0
       
    89         * @return data in DER encoded format
       
    90         */
       
    91 		IMPORT_C const TDesC8& Data() const;
       
    92 
       
    93 		/**
       
    94         * Setter for the tag
       
    95         * @since 3.0
       
    96         * @param aTag tag of the choice
       
    97         */
       
    98 		IMPORT_C void SetTagL(
       
    99             const TTagType aTag );
       
   100 
       
   101         /**
       
   102         * Setter for data
       
   103         * @since 3.0
       
   104         * @param aData data of the choice
       
   105         */
       
   106 		IMPORT_C void SetDataL(
       
   107             const TDesC8& aData );
       
   108 
       
   109     public: // Functions from base classes
       
   110 
       
   111         /**
       
   112         * From MCMSModule
       
   113         * @since 3.0
       
   114         * @param aResult Allocates and sets result in this variable
       
   115         */
       
   116         void EncodeL( HBufC8*& aResult ) const;
       
   117 
       
   118 	 	/**
       
   119         * From MCMSModule
       
   120         * @since 3.0
       
   121         * @param aRawData raw-data to be parsed in this instance
       
   122         */
       
   123         void DecodeL( const TDesC8& aRawData );
       
   124 
       
   125 	 	/**
       
   126         * From MCMSModule
       
   127         * @since 3.0
       
   128         * @return Returns ASN1 encoder and leaves it in CleanupStack
       
   129         */
       
   130         CASN1EncBase* EncoderLC() const;
       
   131 
       
   132     protected:  // New functions
       
   133 
       
   134 	   /**
       
   135         * Protected construction to allow derivation
       
   136         */
       
   137         IMPORT_C void ConstructL(
       
   138             const TTagType aTag,
       
   139             const TDesC8& aData );
       
   140 
       
   141         /**
       
   142         * C++ default constructor.
       
   143         */
       
   144         IMPORT_C CCMSX509GeneralName( );
       
   145 
       
   146 
       
   147     private:    // Data
       
   148 
       
   149         // defines the type of this CHOICE
       
   150         TTagType iTag;
       
   151 
       
   152         // Data
       
   153         HBufC8* iData;
       
   154 
       
   155         // Reserved for extensions
       
   156         MCMSX509GeneralNameExtension* iReserved;
       
   157         
       
   158     };
       
   159 
       
   160 #endif      // CCMSX509GeneralName_H
       
   161 
       
   162 // End of File