williamr@2: /* williamr@2: * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: /** williamr@2: @file williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: williamr@2: #ifndef __CCERTATTRIBUTEFILTER_H__ williamr@2: #define __CCERTATTRIBUTEFILTER_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: /** williamr@2: * A filter for specifying which certificates are required. williamr@2: * williamr@2: * On construction it will accept everything. williamr@2: * The Set... functions can then be used to restrict it. williamr@2: */ williamr@2: class CCertAttributeFilter : public CBase williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Returns a default filter. This filter accepts any williamr@2: * certificate. Call the Set... functions to restrict what it accepts. williamr@2: * williamr@2: * @return A pointer to a new CCertAttributeFilter object. williamr@2: */ williamr@2: IMPORT_C static CCertAttributeFilter* NewL(); williamr@2: /** williamr@2: * Returns a default filter. This filter accepts any certificate. williamr@2: * It leaves the filter on the cleanup stack. williamr@2: * williamr@2: * @return A pointer to a new CCertAttributeFilter object. williamr@2: */ williamr@2: IMPORT_C static CCertAttributeFilter* NewLC(); williamr@2: williamr@2: /** williamr@2: * Read a certificate attribute filter from a stream. williamr@2: */ williamr@2: IMPORT_C static CCertAttributeFilter* NewL(RReadStream& aStream); williamr@2: /** williamr@2: * Write a certificate attribute filter to a stream. williamr@2: */ williamr@2: IMPORT_C void ExternalizeL(RWriteStream& aStream) const; williamr@2: williamr@2: public: williamr@2: // Setter methods williamr@2: /** williamr@2: * Sets the label of the cert that the filter will accept. williamr@2: * williamr@2: * @param aLabel The new label williamr@2: */ williamr@2: IMPORT_C void SetLabel(const TCertLabel& aLabel); williamr@2: williamr@2: /** williamr@2: * Sets the UID of an application which the certificate must support williamr@2: * williamr@2: * @param aUid The new UID williamr@2: */ williamr@2: IMPORT_C void SetUid(TUid aUid); williamr@2: williamr@2: /** williamr@2: * Sets the format of the returned certificates williamr@2: * williamr@2: * @param aFormat The required format williamr@2: */ williamr@2: IMPORT_C void SetFormat(TCertificateFormat aFormat); williamr@2: williamr@2: /** williamr@2: * Sets the owner type of the returned certificates williamr@2: * williamr@2: * @param aOwnerType The owner type. williamr@2: */ williamr@2: IMPORT_C void SetOwnerType(TCertificateOwnerType aOwnerType); williamr@2: williamr@2: /** williamr@2: * Sets the usage that returned certs must be used for. williamr@2: * williamr@2: * Note that the usage is supplied using X509 scheme - williamr@2: * keystore interfaces use the PKCS#15 scheme! williamr@2: * williamr@2: * @param aKeyUsage The key usage williamr@2: */ williamr@2: IMPORT_C void SetKeyUsage(TKeyUsageX509 aKeyUsage); williamr@2: williamr@2: /** williamr@2: * Sets the subject key ID that returned certificates must have. williamr@2: * williamr@2: * @param aSubjectKeyId The subject key ID williamr@2: */ williamr@2: IMPORT_C void SetSubjectKeyId(const TKeyIdentifier& aSubjectKeyId); williamr@2: williamr@2: /** williamr@2: * Sets the issuer key ID that returned certificates must have. williamr@2: * williamr@2: * @param aIssuerKeyId The issuer key ID williamr@2: */ williamr@2: IMPORT_C void SetIssuerKeyId(const TKeyIdentifier& aIssuerKeyId); williamr@2: williamr@2: private: williamr@2: CCertAttributeFilter(); williamr@2: void InternalizeL(RReadStream& aStream); williamr@2: williamr@2: public: williamr@2: /** The filter data. Each data item is accompanied by a williamr@2: '..IsSet' boolean which indicates if the item should be used. williamr@2: Unset values (whose ..IsSet variable is EFalse) should be ignored. williamr@2: */ williamr@2: williamr@2: /** The label that returned certificates must have. */ williamr@2: TCertLabel iLabel; williamr@2: /** Indicates that iLabel should be used. */ williamr@2: TBool iLabelIsSet; williamr@2: /** The application UID that all returned certificates must have. */ williamr@2: TUid iUid; williamr@2: /** Indicates that iUid should be used. */ williamr@2: TBool iUidIsSet; williamr@2: /** The format of certificates that should be included. */ williamr@2: TCertificateFormat iFormat; williamr@2: /** Indicates that iFormat should be used. */ williamr@2: TBool iFormatIsSet; williamr@2: /** The owner type of returned certificates. */ williamr@2: TCertificateOwnerType iOwnerType; williamr@2: /** Indicates that iOwnerType should be used. */ williamr@2: TBool iOwnerTypeIsSet; williamr@2: /** The usage of keys that should be returned. */ williamr@2: TKeyUsageX509 iKeyUsage; williamr@2: /** The subject key that returned certs should have. */ williamr@2: TKeyIdentifier iSubjectKeyId; williamr@2: /** Indicates that iSubjectKeyId should be used. */ williamr@2: TBool iSubjectKeyIdIsSet; williamr@2: /** The issuer key that returned certs should have. */ williamr@2: TKeyIdentifier iIssuerKeyId; williamr@2: /** Indicates that iIssuerKeyId should be used. */ williamr@2: TBool iIssuerKeyIdIsSet; williamr@2: williamr@2: }; williamr@2: williamr@2: #endif