epoc32/include/ccertattributefilter.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 /*
     2 * Copyright (c) 2001-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 *
    16 */
    17 
    18 
    19 
    20 
    21 /**
    22  @file
    23  @publishedAll
    24  @released
    25 */
    26 
    27 #ifndef __CCERTATTRIBUTEFILTER_H__
    28 #define __CCERTATTRIBUTEFILTER_H__
    29 
    30 #include <e32base.h>
    31 #include <s32strm.h>
    32 #include <securitydefs.h>
    33 #include <cctcertinfo.h>
    34 #include <ct.h>
    35 
    36 /** 
    37  * A filter for specifying which certificates are required. 
    38  *
    39  * On construction it will accept everything. 
    40  * The Set... functions can then be used to restrict it.
    41  */
    42 class CCertAttributeFilter : public CBase
    43 	{
    44 public:
    45 	/**
    46 	 * Returns a default filter. This filter accepts any
    47 	 * certificate. Call the Set... functions to restrict what it accepts.
    48 	 *
    49 	 * @return	A pointer to a new CCertAttributeFilter object.
    50 	 */
    51 	IMPORT_C static CCertAttributeFilter* NewL();
    52 	/**
    53 	 * Returns a default filter. This filter accepts any certificate.
    54 	 * It leaves the filter on the cleanup stack.
    55 	 *
    56 	 * @return	A pointer to a new CCertAttributeFilter object.
    57 	 */
    58 	IMPORT_C static CCertAttributeFilter* NewLC();
    59 
    60 	/**
    61 	 * Read a certificate attribute filter from a stream.
    62 	 */
    63 	IMPORT_C static CCertAttributeFilter* NewL(RReadStream& aStream);
    64 	/**
    65 	 * Write a certificate attribute filter to a stream.
    66 	 */
    67 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
    68 	
    69 public:
    70 	// Setter methods
    71 	/** 
    72 	 * Sets the label of the cert that the filter will accept.
    73 	 *	
    74 	 *	@param aLabel	The new label 
    75 	 */
    76 	IMPORT_C void SetLabel(const TCertLabel& aLabel);
    77 	
    78 	/** 
    79 	 * Sets the UID of an application which the certificate must support
    80 	 *
    81 	 * @param aUid	The new UID
    82 	 */
    83 	IMPORT_C void SetUid(TUid aUid);
    84 	
    85 	/** 
    86 	 * Sets the format of the returned certificates
    87 	 *
    88 	 * @param aFormat	The required format
    89 	 */
    90 	IMPORT_C void SetFormat(TCertificateFormat aFormat);
    91 	
    92 	/** 
    93 	 * Sets the owner type of the returned certificates
    94 	 *
    95 	 * @param aOwnerType	The owner type.
    96 	 */
    97 	IMPORT_C void SetOwnerType(TCertificateOwnerType aOwnerType);
    98 	
    99 	/** 
   100 	 * Sets the usage that returned certs must be used for.  
   101 	 * 
   102 	 * Note that the usage is supplied using X509 scheme - 
   103 	 * keystore interfaces use the PKCS#15 scheme!
   104 	 *
   105 	 * @param aKeyUsage	The key usage
   106 	 */
   107 	IMPORT_C void SetKeyUsage(TKeyUsageX509 aKeyUsage);
   108 	
   109 	/** 
   110 	 * Sets the subject key ID that returned certificates must have.
   111 	 *
   112 	 * @param aSubjectKeyId	The subject key ID
   113 	 */
   114 	IMPORT_C void SetSubjectKeyId(const TKeyIdentifier& aSubjectKeyId);
   115 	
   116 	/** 
   117 	 * Sets the issuer key ID that returned certificates must have.
   118 	 * 
   119 	 * @param aIssuerKeyId	The issuer key ID
   120 	 */
   121 	IMPORT_C void SetIssuerKeyId(const TKeyIdentifier& aIssuerKeyId);
   122 
   123 private:
   124 	CCertAttributeFilter();
   125 	void InternalizeL(RReadStream& aStream);
   126 	
   127 public:
   128 	/** The filter data. Each data item is accompanied by a
   129 	   '..IsSet' boolean which indicates if the item should be used.
   130 	   Unset values (whose ..IsSet variable is EFalse) should be ignored.
   131 	*/
   132 		
   133 	/** The label that returned certificates must have. */
   134 	TCertLabel iLabel;
   135 	/** Indicates that iLabel should be used. */
   136 	TBool iLabelIsSet;
   137 	/** The application UID that all returned certificates must have. */
   138 	TUid iUid;
   139 	/** Indicates that iUid should be used. */
   140 	TBool iUidIsSet;
   141 	/** The format of certificates that should be included. */
   142 	TCertificateFormat iFormat;
   143 	/** Indicates that iFormat should be used. */
   144 	TBool iFormatIsSet;
   145 	/** The owner type of returned certificates. */
   146 	TCertificateOwnerType iOwnerType;
   147 	/** Indicates that iOwnerType should be used. */
   148 	TBool iOwnerTypeIsSet;
   149 	/** The usage of keys that should be returned. */
   150 	TKeyUsageX509 iKeyUsage;
   151 	/** The subject key that returned certs should have. */
   152 	TKeyIdentifier iSubjectKeyId;
   153 	/** Indicates that iSubjectKeyId should be used. */
   154 	TBool iSubjectKeyIdIsSet;
   155 	/** The issuer key that returned certs should have. */
   156 	TKeyIdentifier iIssuerKeyId;
   157 	/** Indicates that iIssuerKeyId should be used. */
   158 	TBool iIssuerKeyIdIsSet;
   159 	
   160 	};
   161 
   162 #endif