os/security/cryptoservices/certificateandkeymgmt/inc/x509constraintext.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/inc/x509constraintext.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,228 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* Symbian specific X509.v3 certificate extensions that constrain the
    1.19 +* the devices, secure ids, vendor ids and capabilities for which 
    1.20 +* a software install signing certificate is valid.
    1.21 +*
    1.22 +*/
    1.23 +
    1.24 +
    1.25 +/**
    1.26 + @file 
    1.27 + @internalTechnology 
    1.28 +*/
    1.29 +
    1.30 +#ifndef __X509CONSTRAINTEXT_H__
    1.31 +#define __X509CONSTRAINTEXT_H__
    1.32 +
    1.33 +#include <e32base.h>
    1.34 +#include <x509certext.h>
    1.35 +
    1.36 +class CX509IntListExt : public CX509ExtensionBase 
    1.37 +/** 
    1.38 +A Symbian specific X.509 v3 certificate extension that contains an arbitrary 
    1.39 +list of 32 bit integers.	
    1.40 +
    1.41 +@internalTechnology
    1.42 +@released
    1.43 +*/
    1.44 +	{
    1.45 +public:
    1.46 +	/** 
    1.47 +	Creates a new CX509IntListExt object from the binary (DER) encoded 
    1.48 +	representation of a sequence of integers.
    1.49 +	
    1.50 +	@param aBinaryData	The encoded binary representation.
    1.51 +	@return				The new CX509IntListExt object.
    1.52 +	*/
    1.53 +	IMPORT_C static CX509IntListExt* NewL(const TDesC8& aBinaryData);
    1.54 +	
    1.55 +	/**
    1.56 +	Creates a new CX509IntListExt object from the binary (DER) encoded 
    1.57 +	representation of a sequence of integers, and puts a pointer to it 
    1.58 +	onto the cleanup stack.
    1.59 +	
    1.60 +	@param aBinaryData	The encoded binary representation.
    1.61 +	@return				The new CX509IntListExt object. 
    1.62 +	*/
    1.63 +	IMPORT_C static CX509IntListExt* NewLC(const TDesC8& aBinaryData);
    1.64 +			
    1.65 +	/**
    1.66 +	Destructor.	
    1.67 +	Frees all resources owned by the object.
    1.68 +	*/
    1.69 +	~CX509IntListExt();
    1.70 +	
    1.71 +	/**	
    1.72 +	Gets a reference to the array of decoded integers.
    1.73 +	Ownership is not transferred.
    1.74 +	@return A reference to the array of decoded integers.
    1.75 +	*/
    1.76 +	IMPORT_C const RArray<TInt>& IntArray() const;
    1.77 +	
    1.78 +protected:
    1.79 +	/** Second-phase constructor.
    1.80 +	* 
    1.81 +	* @param aBinaryData	The encoded binary representation.
    1.82 +	* @param aPos			The position from which to start decoding. */
    1.83 +	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
    1.84 +	
    1.85 +	/**
    1.86 +	Decodes the binary representation of a sequence of integers.
    1.87 +		
    1.88 +	@param aBinaryData	The encoded binary representation. This is the same as 
    1.89 +						passed to ConstructL().
    1.90 +	@param aPos			The position from which to start decoding. Note that 
    1.91 +						the value passed points, in effect, to the content, 
    1.92 +						bypassing the header data. 
    1.93 +	*/
    1.94 +	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);	
    1.95 +	
    1.96 +private:
    1.97 +	/**	The decoded array of integers. */	
    1.98 +	RArray<TInt> iIntArray;
    1.99 +	};
   1.100 +
   1.101 +class CX509Utf8StringListExt : public CX509ExtensionBase 
   1.102 +/** 
   1.103 +A Symbian specific X.509 v3 certificate extension that contains an arbitrary 
   1.104 +list of UTF-8 strings.
   1.105 +
   1.106 +@internalTechnology
   1.107 +@released
   1.108 +*/
   1.109 +	{
   1.110 +public:
   1.111 +	/** 
   1.112 +	Creates a new CX509Utf8StringListExt object from the binary (DER) encoded 
   1.113 +	representation of a sequence of integers.
   1.114 +	
   1.115 +	@param aBinaryData	The encoded binary representation.
   1.116 +	@return				The new CX509Utf8StringListExt object.
   1.117 +	*/
   1.118 +	IMPORT_C static CX509Utf8StringListExt* NewL(const TDesC8& aBinaryData);
   1.119 +	
   1.120 +	/**
   1.121 +	Creates a new CX509Utf8StringListExt object from the binary (DER) encoded 
   1.122 +	representation of a sequence of integers, and puts a pointer to it 
   1.123 +	onto the cleanup stack.
   1.124 +	
   1.125 +	@param aBinaryData	The encoded binary representation.
   1.126 +	@return				The new CX509Utf8StringListExt object. 
   1.127 +	*/
   1.128 +	IMPORT_C static CX509Utf8StringListExt* NewLC(const TDesC8& aBinaryData);
   1.129 +		
   1.130 +	/**
   1.131 +	Destructor.	
   1.132 +	Frees all resources owned by the object.
   1.133 +	*/
   1.134 +	~CX509Utf8StringListExt();
   1.135 +	
   1.136 +	/**	
   1.137 +	Gets a reference to the array of decoded strings (UTF-16).
   1.138 +	Ownership is not transferred.				
   1.139 +	@return A reference to the array of decoded strings in UTF-16.
   1.140 +	*/
   1.141 +	IMPORT_C const RPointerArray<HBufC>& StringArray() const;
   1.142 +	
   1.143 +protected:
   1.144 +	/** Second-phase constructor.	 
   1.145 +	@param aBinaryData	The encoded binary representation.
   1.146 +	@param aPos			The position from which to start decoding. 
   1.147 +	*/
   1.148 +	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
   1.149 +	
   1.150 +	/**		
   1.151 +	Decodes the binary representation of a sequence of UTF-8 strings. The 
   1.152 +	strings are converted and stored internal as UTF-8.
   1.153 +		
   1.154 +	@param aBinaryData	The encoded binary representation. This is the same as 
   1.155 +						passed to ConstructL().
   1.156 +	@param aPos			The position from which to start decoding. Note that 
   1.157 +						the value passed points, in effect, to the content, 
   1.158 +						bypassing the header data. 
   1.159 +	*/
   1.160 +	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);	
   1.161 +	
   1.162 +private:
   1.163 +	/**	The decoded array of strings in UTF-16.	*/
   1.164 +	RPointerArray<HBufC> iStringArray;
   1.165 +	};
   1.166 +
   1.167 +/** 
   1.168 +A Symbian specific X.509 v3 certificate extension that contains a capability 
   1.169 +set encoded as a bit string.
   1.170 +
   1.171 +@internalTechnology
   1.172 +@released
   1.173 +*/
   1.174 +class CX509CapabilitySetExt : public CX509ExtensionBase
   1.175 +	{
   1.176 +public:
   1.177 +	/** 
   1.178 +	Creates a new CX509CapabilitySetExt object from the binary (DER) encoded 
   1.179 +	representation of a sequence of integers.
   1.180 +	
   1.181 +	@param aBinaryData	The encoded binary representation.
   1.182 +	@return				The new CX509CapabilitySetExt object.
   1.183 +	*/
   1.184 +	IMPORT_C static CX509CapabilitySetExt* NewL(const TDesC8& aBinaryData);
   1.185 +	
   1.186 +	/**
   1.187 +	Creates a new CX509CapabilitySetExt object from the binary (DER) encoded 
   1.188 +	representation of a sequence of integers, and puts a pointer to it 
   1.189 +	onto the cleanup stack.
   1.190 +	
   1.191 +	@param aBinaryData	The encoded binary representation.
   1.192 +	@return				The new CX509CapabilitySetExt object. 
   1.193 +	*/
   1.194 +	IMPORT_C static CX509CapabilitySetExt* NewLC(const TDesC8& aBinaryData);
   1.195 +		
   1.196 +	/**
   1.197 +	Destructor.	
   1.198 +	Frees all resources owned by the object.
   1.199 +	*/
   1.200 +	~CX509CapabilitySetExt();
   1.201 +	
   1.202 +	/** Gets a reference to the capability set.	
   1.203 +	@return the capability set represented by the bit string.
   1.204 +	*/
   1.205 +	IMPORT_C const TCapabilitySet& CapabilitySet() const;
   1.206 +
   1.207 +protected:
   1.208 +	/** Second-phase constructor.
   1.209 +	 
   1.210 +	@param aBinaryData	The encoded binary representation.
   1.211 +	@param aPos			The position from which to start decoding. 
   1.212 +	*/
   1.213 +	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
   1.214 +	
   1.215 +	/**
   1.216 +	Constructs the a TCapabilitySet from a DER encoded bit string.
   1.217 +	
   1.218 +	@param aBinaryData	The encoded binary representation. This is the same as 
   1.219 +						passed to ConstructL().
   1.220 +	@param aPos			The position from which to start decoding. Note that 
   1.221 +						the value passed points, in effect, to the content, 
   1.222 +						bypassing the header data. 
   1.223 +	*/
   1.224 +	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
   1.225 +	
   1.226 +private:	
   1.227 +	/** The decoded capability set */
   1.228 +	TCapabilitySet iCapabilitySet;
   1.229 +	};
   1.230 +
   1.231 +#endif