epoc32/include/mcertstore.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/mcertstore.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mcertstore.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,178 @@
     1.4 -mcertstore.h
     1.5 +/*
     1.6 +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* under the terms of the License "Eclipse Public License v1.0"
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description: 
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +
    1.24 +
    1.25 +/**
    1.26 + @file
    1.27 + @publishedAll
    1.28 + @released
    1.29 +*/
    1.30 +
    1.31 +#ifndef __MCERTINFO_H__
    1.32 +#define __MCERTINFO_H__
    1.33 +
    1.34 +#include <ct/rmpointerarray.h>
    1.35 +
    1.36 +// Forward declarations
    1.37 +class CCTCertInfo;
    1.38 +class CCertAttributeFilter;
    1.39 +class TCTTokenObjectHandle;
    1.40 +
    1.41 +
    1.42 +/**
    1.43 + * @publishedPartner
    1.44 + * @released
    1.45 + * 
    1.46 + * Defines the interface for a read-only certificate store.
    1.47 + *
    1.48 + * This documentation describes the security policy that must be enforced by
    1.49 + * implementations of the interface.
    1.50 + */
    1.51 +class MCertStore
    1.52 +	{
    1.53 +public:
    1.54 +	/**
    1.55 +	 * Listing Certificates
    1.56 +	 */
    1.57 +
    1.58 +	/**
    1.59 +	 * Get a list of all certificates that satisfy the supplied filter.
    1.60 +	 * 	
    1.61 +	 * This is an async function; all errors are reported by completing aStatus
    1.62 +	 * with the error value, and it can be cancelled with CancelList().
    1.63 +	 * 
    1.64 +	 * @param aCerts An array into which the returned certificates are placed.
    1.65 +	 * @param aFilter A filter to select which certificates should be included.
    1.66 +	 * @param aStatus A request status that will be completed when the operation completes.
    1.67 +	 */	
    1.68 +	virtual void List(RMPointerArray<CCTCertInfo>& aCerts, const CCertAttributeFilter& aFilter,
    1.69 +					  TRequestStatus& aStatus) = 0;
    1.70 +
    1.71 +	/** Cancels an ongoing List() operation. */
    1.72 +	virtual void CancelList() = 0;
    1.73 +
    1.74 +	/**
    1.75 +	 * Getting a certificate given a handle.
    1.76 +	 */
    1.77 +	
    1.78 +	/**
    1.79 +	 * Get a certificate given its handle.
    1.80 +	 * 
    1.81 +	 * @param aCertInfo The returned certificate.
    1.82 +	 * @param aHandle The handle of the certificate to return.
    1.83 +	 * @param aStatus The request status object; contains the result of the
    1.84 +	 *     GetCert() request when complete. Set to KErrCancel if any outstanding
    1.85 +	 *     request is cancelled.
    1.86 +	 */
    1.87 +	virtual void GetCert(CCTCertInfo*& aCertInfo, const TCTTokenObjectHandle& aHandle, 
    1.88 +						 TRequestStatus& aStatus) = 0;
    1.89 +		
    1.90 +	/** Cancel an ongoing GetCert() operation. */
    1.91 +	virtual void CancelGetCert() = 0;
    1.92 +	
    1.93 +	/**
    1.94 +	 * Querying the applications of a certificate.
    1.95 +	 */
    1.96 +
    1.97 +	/**
    1.98 +	 * Get the list of the applications associcated with certificate.
    1.99 +	 * 
   1.100 +	 * Applications are represented by UIDs. Examples would be Software Install,
   1.101 +	 * TLS, WTLS, WMLScript, SignText, etc..
   1.102 +	 * 
   1.103 +	 * @param aCertInfo The certificate to return applications for.
   1.104 +	 * @param aAplications An array to save the applications in.
   1.105 +	 * @param aStatus The request status object; contains the result of the
   1.106 +	 *     Applications() request when complete. Set to KErrCancel if any
   1.107 +	 *     outstanding request is cancelled.
   1.108 +	 */
   1.109 +	virtual void Applications(const CCTCertInfo& aCertInfo, RArray<TUid>& aAplications,
   1.110 +							  TRequestStatus& aStatus) = 0;
   1.111 +		
   1.112 +	/** Cancels an ongoing Applications() operation. */
   1.113 +	virtual void CancelApplications() = 0;
   1.114 +	
   1.115 +	/**
   1.116 +	 * Tests if a certificate is applicable to a particular application.	
   1.117 +	 * 
   1.118 +	 * @param aCertInfo The certificate in question.
   1.119 +	 * @param aApplication The application.
   1.120 +	 * @param aIsApplicable Set to ETrue or EFalse by the function to return the result.
   1.121 +	 * @param aStatus The request status object; contains the result of the
   1.122 +	 *     IsApplicable() request when complete. Set to KErrCancel if any
   1.123 +	 *     outstanding request is cancelled.
   1.124 +	 */
   1.125 +	virtual void IsApplicable(const CCTCertInfo& aCertInfo, TUid aApplication, 
   1.126 +							  TBool& aIsApplicable, TRequestStatus& aStatus) = 0;
   1.127 +
   1.128 +	/** Cancels an ongoing IsApplicable() operation. */
   1.129 +	virtual void CancelIsApplicable() = 0;
   1.130 +
   1.131 +	/**
   1.132 +	 * Trust querying
   1.133 +	 */
   1.134 +	
   1.135 +	/**
   1.136 +	 * Tests whether a certificate is trusted.
   1.137 +	 * 
   1.138 +	 * Trust is only meaningful for CA certificates where it means that the
   1.139 +	 * certificate can be used as a trust root for the purposes of certificate
   1.140 +	 * validation.
   1.141 +	 * 
   1.142 +	 * @param aCertInfo The certificate we are interested in.
   1.143 +	 * @param aTrusted Used to return the trust status.
   1.144 +	 * @param aStatus The request status object; contains the result of the
   1.145 +	 *     Trusted() request when complete. Set to KErrCancel if any outstanding
   1.146 +	 *     request is cancelled.
   1.147 +	 */
   1.148 +	virtual void Trusted(const CCTCertInfo& aCertInfo, TBool& aTrusted, 
   1.149 +						 TRequestStatus& aStatus) = 0;
   1.150 +
   1.151 +	/** Cancels an ongoing Trusted() operation. */
   1.152 +	virtual void CancelTrusted() = 0;
   1.153 +
   1.154 +	/**
   1.155 +	 * Retrieving the actual certificate
   1.156 +	 */
   1.157 +
   1.158 +	/**
   1.159 +	 * Retrieves the actual data of the certificate.	
   1.160 +	 *
   1.161 +	 * @param aCertInfo The certificate to retrieve.
   1.162 +	 * @param aEncodedCert A buffer to put the certificate in. It must be big
   1.163 +	 *     enough; the size is stored in aCertInfo.
   1.164 +	 * @param aStatus The request status object; contains the result of the
   1.165 +	 *     Retrieve()request when complete. Set to KErrCancel if any outstanding
   1.166 +	 *     request is cancelled.
   1.167 +	 *
   1.168 +	 * @capability ReadUserData This requires the ReadUserData capability when
   1.169 +	 *     applied to user certificates, as these may contain sensitive user data.
   1.170 +	 * @leave KErrPermissionDenied If called for a user certificate when the
   1.171 +	 *     caller doesn't have the ReadUserData capability.
   1.172 +	 */
   1.173 +	virtual void Retrieve(const CCTCertInfo& aCertInfo, TDes8& aEncodedCert, 
   1.174 +						  TRequestStatus& aStatus) = 0;
   1.175 +		
   1.176 +	/** Cancels an ongoing Retrieve() operation. */
   1.177 +	virtual void CancelRetrieve() = 0;
   1.178 +		
   1.179 +	};
   1.180 +
   1.181 +
   1.182 +#endif