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