os/security/cryptoservices/certificateandkeymgmt/inc/x509constraintext.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.
     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 * Symbian specific X509.v3 certificate extensions that constrain the
    16 * the devices, secure ids, vendor ids and capabilities for which 
    17 * a software install signing certificate is valid.
    18 *
    19 */
    20 
    21 
    22 /**
    23  @file 
    24  @internalTechnology 
    25 */
    26 
    27 #ifndef __X509CONSTRAINTEXT_H__
    28 #define __X509CONSTRAINTEXT_H__
    29 
    30 #include <e32base.h>
    31 #include <x509certext.h>
    32 
    33 class CX509IntListExt : public CX509ExtensionBase 
    34 /** 
    35 A Symbian specific X.509 v3 certificate extension that contains an arbitrary 
    36 list of 32 bit integers.	
    37 
    38 @internalTechnology
    39 @released
    40 */
    41 	{
    42 public:
    43 	/** 
    44 	Creates a new CX509IntListExt object from the binary (DER) encoded 
    45 	representation of a sequence of integers.
    46 	
    47 	@param aBinaryData	The encoded binary representation.
    48 	@return				The new CX509IntListExt object.
    49 	*/
    50 	IMPORT_C static CX509IntListExt* NewL(const TDesC8& aBinaryData);
    51 	
    52 	/**
    53 	Creates a new CX509IntListExt object from the binary (DER) encoded 
    54 	representation of a sequence of integers, and puts a pointer to it 
    55 	onto the cleanup stack.
    56 	
    57 	@param aBinaryData	The encoded binary representation.
    58 	@return				The new CX509IntListExt object. 
    59 	*/
    60 	IMPORT_C static CX509IntListExt* NewLC(const TDesC8& aBinaryData);
    61 			
    62 	/**
    63 	Destructor.	
    64 	Frees all resources owned by the object.
    65 	*/
    66 	~CX509IntListExt();
    67 	
    68 	/**	
    69 	Gets a reference to the array of decoded integers.
    70 	Ownership is not transferred.
    71 	@return A reference to the array of decoded integers.
    72 	*/
    73 	IMPORT_C const RArray<TInt>& IntArray() const;
    74 	
    75 protected:
    76 	/** Second-phase constructor.
    77 	* 
    78 	* @param aBinaryData	The encoded binary representation.
    79 	* @param aPos			The position from which to start decoding. */
    80 	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
    81 	
    82 	/**
    83 	Decodes the binary representation of a sequence of integers.
    84 		
    85 	@param aBinaryData	The encoded binary representation. This is the same as 
    86 						passed to ConstructL().
    87 	@param aPos			The position from which to start decoding. Note that 
    88 						the value passed points, in effect, to the content, 
    89 						bypassing the header data. 
    90 	*/
    91 	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);	
    92 	
    93 private:
    94 	/**	The decoded array of integers. */	
    95 	RArray<TInt> iIntArray;
    96 	};
    97 
    98 class CX509Utf8StringListExt : public CX509ExtensionBase 
    99 /** 
   100 A Symbian specific X.509 v3 certificate extension that contains an arbitrary 
   101 list of UTF-8 strings.
   102 
   103 @internalTechnology
   104 @released
   105 */
   106 	{
   107 public:
   108 	/** 
   109 	Creates a new CX509Utf8StringListExt object from the binary (DER) encoded 
   110 	representation of a sequence of integers.
   111 	
   112 	@param aBinaryData	The encoded binary representation.
   113 	@return				The new CX509Utf8StringListExt object.
   114 	*/
   115 	IMPORT_C static CX509Utf8StringListExt* NewL(const TDesC8& aBinaryData);
   116 	
   117 	/**
   118 	Creates a new CX509Utf8StringListExt object from the binary (DER) encoded 
   119 	representation of a sequence of integers, and puts a pointer to it 
   120 	onto the cleanup stack.
   121 	
   122 	@param aBinaryData	The encoded binary representation.
   123 	@return				The new CX509Utf8StringListExt object. 
   124 	*/
   125 	IMPORT_C static CX509Utf8StringListExt* NewLC(const TDesC8& aBinaryData);
   126 		
   127 	/**
   128 	Destructor.	
   129 	Frees all resources owned by the object.
   130 	*/
   131 	~CX509Utf8StringListExt();
   132 	
   133 	/**	
   134 	Gets a reference to the array of decoded strings (UTF-16).
   135 	Ownership is not transferred.				
   136 	@return A reference to the array of decoded strings in UTF-16.
   137 	*/
   138 	IMPORT_C const RPointerArray<HBufC>& StringArray() const;
   139 	
   140 protected:
   141 	/** Second-phase constructor.	 
   142 	@param aBinaryData	The encoded binary representation.
   143 	@param aPos			The position from which to start decoding. 
   144 	*/
   145 	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
   146 	
   147 	/**		
   148 	Decodes the binary representation of a sequence of UTF-8 strings. The 
   149 	strings are converted and stored internal as UTF-8.
   150 		
   151 	@param aBinaryData	The encoded binary representation. This is the same as 
   152 						passed to ConstructL().
   153 	@param aPos			The position from which to start decoding. Note that 
   154 						the value passed points, in effect, to the content, 
   155 						bypassing the header data. 
   156 	*/
   157 	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);	
   158 	
   159 private:
   160 	/**	The decoded array of strings in UTF-16.	*/
   161 	RPointerArray<HBufC> iStringArray;
   162 	};
   163 
   164 /** 
   165 A Symbian specific X.509 v3 certificate extension that contains a capability 
   166 set encoded as a bit string.
   167 
   168 @internalTechnology
   169 @released
   170 */
   171 class CX509CapabilitySetExt : public CX509ExtensionBase
   172 	{
   173 public:
   174 	/** 
   175 	Creates a new CX509CapabilitySetExt object from the binary (DER) encoded 
   176 	representation of a sequence of integers.
   177 	
   178 	@param aBinaryData	The encoded binary representation.
   179 	@return				The new CX509CapabilitySetExt object.
   180 	*/
   181 	IMPORT_C static CX509CapabilitySetExt* NewL(const TDesC8& aBinaryData);
   182 	
   183 	/**
   184 	Creates a new CX509CapabilitySetExt object from the binary (DER) encoded 
   185 	representation of a sequence of integers, and puts a pointer to it 
   186 	onto the cleanup stack.
   187 	
   188 	@param aBinaryData	The encoded binary representation.
   189 	@return				The new CX509CapabilitySetExt object. 
   190 	*/
   191 	IMPORT_C static CX509CapabilitySetExt* NewLC(const TDesC8& aBinaryData);
   192 		
   193 	/**
   194 	Destructor.	
   195 	Frees all resources owned by the object.
   196 	*/
   197 	~CX509CapabilitySetExt();
   198 	
   199 	/** Gets a reference to the capability set.	
   200 	@return the capability set represented by the bit string.
   201 	*/
   202 	IMPORT_C const TCapabilitySet& CapabilitySet() const;
   203 
   204 protected:
   205 	/** Second-phase constructor.
   206 	 
   207 	@param aBinaryData	The encoded binary representation.
   208 	@param aPos			The position from which to start decoding. 
   209 	*/
   210 	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
   211 	
   212 	/**
   213 	Constructs the a TCapabilitySet from a DER encoded bit string.
   214 	
   215 	@param aBinaryData	The encoded binary representation. This is the same as 
   216 						passed to ConstructL().
   217 	@param aPos			The position from which to start decoding. Note that 
   218 						the value passed points, in effect, to the content, 
   219 						bypassing the header data. 
   220 	*/
   221 	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
   222 	
   223 private:	
   224 	/** The decoded capability set */
   225 	TCapabilitySet iCapabilitySet;
   226 	};
   227 
   228 #endif