epoc32/include/mcertstore.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 __MCERTINFO_H__
williamr@2
    26
#define __MCERTINFO_H__
williamr@2
    27
williamr@2
    28
#include <ct/rmpointerarray.h>
williamr@2
    29
williamr@2
    30
// Forward declarations
williamr@2
    31
class CCTCertInfo;
williamr@2
    32
class CCertAttributeFilter;
williamr@2
    33
class TCTTokenObjectHandle;
williamr@2
    34
williamr@2
    35
williamr@2
    36
/**
williamr@2
    37
 * 
williamr@2
    38
 * Defines the interface for a read-only certificate store.
williamr@2
    39
 *
williamr@2
    40
 * This documentation describes the security policy that must be enforced by
williamr@2
    41
 * implementations of the interface.
williamr@2
    42
 */
williamr@2
    43
class MCertStore
williamr@2
    44
	{
williamr@2
    45
public:
williamr@2
    46
	/**
williamr@2
    47
	 * Listing Certificates
williamr@2
    48
	 */
williamr@2
    49
williamr@2
    50
	/**
williamr@2
    51
	 * Get a list of all certificates that satisfy the supplied filter.
williamr@2
    52
	 * 	
williamr@2
    53
	 * This is an async function; all errors are reported by completing aStatus
williamr@2
    54
	 * with the error value, and it can be cancelled with CancelList().
williamr@2
    55
	 * 
williamr@2
    56
	 * @param aCerts An array into which the returned certificates are placed.
williamr@2
    57
	 * @param aFilter A filter to select which certificates should be included.
williamr@2
    58
	 * @param aStatus A request status that will be completed when the operation completes.
williamr@2
    59
	 */	
williamr@2
    60
	virtual void List(RMPointerArray<CCTCertInfo>& aCerts, const CCertAttributeFilter& aFilter,
williamr@2
    61
					  TRequestStatus& aStatus) = 0;
williamr@2
    62
williamr@2
    63
	/** Cancels an ongoing List() operation. */
williamr@2
    64
	virtual void CancelList() = 0;
williamr@2
    65
williamr@2
    66
	/**
williamr@2
    67
	 * Getting a certificate given a handle.
williamr@2
    68
	 */
williamr@2
    69
	
williamr@2
    70
	/**
williamr@2
    71
	 * Get a certificate given its handle.
williamr@2
    72
	 * 
williamr@2
    73
	 * @param aCertInfo The returned certificate.
williamr@2
    74
	 * @param aHandle The handle of the certificate to return.
williamr@2
    75
	 * @param aStatus The request status object; contains the result of the
williamr@2
    76
	 *     GetCert() request when complete. Set to KErrCancel if any outstanding
williamr@2
    77
	 *     request is cancelled.
williamr@2
    78
	 */
williamr@2
    79
	virtual void GetCert(CCTCertInfo*& aCertInfo, const TCTTokenObjectHandle& aHandle, 
williamr@2
    80
						 TRequestStatus& aStatus) = 0;
williamr@2
    81
		
williamr@2
    82
	/** Cancel an ongoing GetCert() operation. */
williamr@2
    83
	virtual void CancelGetCert() = 0;
williamr@2
    84
	
williamr@2
    85
	/**
williamr@2
    86
	 * Querying the applications of a certificate.
williamr@2
    87
	 */
williamr@2
    88
williamr@2
    89
	/**
williamr@2
    90
	 * Get the list of the applications associcated with certificate.
williamr@2
    91
	 * 
williamr@2
    92
	 * Applications are represented by UIDs. Examples would be Software Install,
williamr@2
    93
	 * TLS, WTLS, WMLScript, SignText, etc..
williamr@2
    94
	 * 
williamr@2
    95
	 * @param aCertInfo The certificate to return applications for.
williamr@2
    96
	 * @param aAplications An array to save the applications in.
williamr@2
    97
	 * @param aStatus The request status object; contains the result of the
williamr@2
    98
	 *     Applications() request when complete. Set to KErrCancel if any
williamr@2
    99
	 *     outstanding request is cancelled.
williamr@2
   100
	 */
williamr@2
   101
	virtual void Applications(const CCTCertInfo& aCertInfo, RArray<TUid>& aAplications,
williamr@2
   102
							  TRequestStatus& aStatus) = 0;
williamr@2
   103
		
williamr@2
   104
	/** Cancels an ongoing Applications() operation. */
williamr@2
   105
	virtual void CancelApplications() = 0;
williamr@2
   106
	
williamr@2
   107
	/**
williamr@2
   108
	 * Tests if a certificate is applicable to a particular application.	
williamr@2
   109
	 * 
williamr@2
   110
	 * @param aCertInfo The certificate in question.
williamr@2
   111
	 * @param aApplication The application.
williamr@2
   112
	 * @param aIsApplicable Set to ETrue or EFalse by the function to return the result.
williamr@2
   113
	 * @param aStatus The request status object; contains the result of the
williamr@2
   114
	 *     IsApplicable() request when complete. Set to KErrCancel if any
williamr@2
   115
	 *     outstanding request is cancelled.
williamr@2
   116
	 */
williamr@2
   117
	virtual void IsApplicable(const CCTCertInfo& aCertInfo, TUid aApplication, 
williamr@2
   118
							  TBool& aIsApplicable, TRequestStatus& aStatus) = 0;
williamr@2
   119
williamr@2
   120
	/** Cancels an ongoing IsApplicable() operation. */
williamr@2
   121
	virtual void CancelIsApplicable() = 0;
williamr@2
   122
williamr@2
   123
	/**
williamr@2
   124
	 * Trust querying
williamr@2
   125
	 */
williamr@2
   126
	
williamr@2
   127
	/**
williamr@2
   128
	 * Tests whether a certificate is trusted.
williamr@2
   129
	 * 
williamr@2
   130
	 * Trust is only meaningful for CA certificates where it means that the
williamr@2
   131
	 * certificate can be used as a trust root for the purposes of certificate
williamr@2
   132
	 * validation.
williamr@2
   133
	 * 
williamr@2
   134
	 * @param aCertInfo The certificate we are interested in.
williamr@2
   135
	 * @param aTrusted Used to return the trust status.
williamr@2
   136
	 * @param aStatus The request status object; contains the result of the
williamr@2
   137
	 *     Trusted() request when complete. Set to KErrCancel if any outstanding
williamr@2
   138
	 *     request is cancelled.
williamr@2
   139
	 */
williamr@2
   140
	virtual void Trusted(const CCTCertInfo& aCertInfo, TBool& aTrusted, 
williamr@2
   141
						 TRequestStatus& aStatus) = 0;
williamr@2
   142
williamr@2
   143
	/** Cancels an ongoing Trusted() operation. */
williamr@2
   144
	virtual void CancelTrusted() = 0;
williamr@2
   145
williamr@2
   146
	/**
williamr@2
   147
	 * Retrieving the actual certificate
williamr@2
   148
	 */
williamr@2
   149
williamr@2
   150
	/**
williamr@2
   151
	 * Retrieves the actual data of the certificate.	
williamr@2
   152
	 *
williamr@2
   153
	 * @param aCertInfo The certificate to retrieve.
williamr@2
   154
	 * @param aEncodedCert A buffer to put the certificate in. It must be big
williamr@2
   155
	 *     enough; the size is stored in aCertInfo.
williamr@2
   156
	 * @param aStatus The request status object; contains the result of the
williamr@2
   157
	 *     Retrieve()request when complete. Set to KErrCancel if any outstanding
williamr@2
   158
	 *     request is cancelled.
williamr@2
   159
	 *
williamr@2
   160
	 * @capability ReadUserData This requires the ReadUserData capability when
williamr@2
   161
	 *     applied to user certificates, as these may contain sensitive user data.
williamr@2
   162
	 * @leave KErrPermissionDenied If called for a user certificate when the
williamr@2
   163
	 *     caller doesn't have the ReadUserData capability.
williamr@2
   164
	 */
williamr@2
   165
	virtual void Retrieve(const CCTCertInfo& aCertInfo, TDes8& aEncodedCert, 
williamr@2
   166
						  TRequestStatus& aStatus) = 0;
williamr@2
   167
		
williamr@2
   168
	/** Cancels an ongoing Retrieve() operation. */
williamr@2
   169
	virtual void CancelRetrieve() = 0;
williamr@2
   170
		
williamr@2
   171
	};
williamr@2
   172
williamr@2
   173
williamr@2
   174
#endif