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