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