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