epoc32/include/mcertstore.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 /*
     2 * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 
    20 
    21 /**
    22  @file
    23  @publishedAll
    24  @released
    25 */
    26 
    27 #ifndef __MCERTINFO_H__
    28 #define __MCERTINFO_H__
    29 
    30 #include <ct/rmpointerarray.h>
    31 
    32 // Forward declarations
    33 class CCTCertInfo;
    34 class CCertAttributeFilter;
    35 class TCTTokenObjectHandle;
    36 
    37 
    38 /**
    39  * @publishedPartner
    40  * @released
    41  * 
    42  * Defines the interface for a read-only certificate store.
    43  *
    44  * This documentation describes the security policy that must be enforced by
    45  * implementations of the interface.
    46  */
    47 class MCertStore
    48 	{
    49 public:
    50 	/**
    51 	 * Listing Certificates
    52 	 */
    53 
    54 	/**
    55 	 * Get a list of all certificates that satisfy the supplied filter.
    56 	 * 	
    57 	 * This is an async function; all errors are reported by completing aStatus
    58 	 * with the error value, and it can be cancelled with CancelList().
    59 	 * 
    60 	 * @param aCerts An array into which the returned certificates are placed.
    61 	 * @param aFilter A filter to select which certificates should be included.
    62 	 * @param aStatus A request status that will be completed when the operation completes.
    63 	 */	
    64 	virtual void List(RMPointerArray<CCTCertInfo>& aCerts, const CCertAttributeFilter& aFilter,
    65 					  TRequestStatus& aStatus) = 0;
    66 
    67 	/** Cancels an ongoing List() operation. */
    68 	virtual void CancelList() = 0;
    69 
    70 	/**
    71 	 * Getting a certificate given a handle.
    72 	 */
    73 	
    74 	/**
    75 	 * Get a certificate given its handle.
    76 	 * 
    77 	 * @param aCertInfo The returned certificate.
    78 	 * @param aHandle The handle of the certificate to return.
    79 	 * @param aStatus The request status object; contains the result of the
    80 	 *     GetCert() request when complete. Set to KErrCancel if any outstanding
    81 	 *     request is cancelled.
    82 	 */
    83 	virtual void GetCert(CCTCertInfo*& aCertInfo, const TCTTokenObjectHandle& aHandle, 
    84 						 TRequestStatus& aStatus) = 0;
    85 		
    86 	/** Cancel an ongoing GetCert() operation. */
    87 	virtual void CancelGetCert() = 0;
    88 	
    89 	/**
    90 	 * Querying the applications of a certificate.
    91 	 */
    92 
    93 	/**
    94 	 * Get the list of the applications associcated with certificate.
    95 	 * 
    96 	 * Applications are represented by UIDs. Examples would be Software Install,
    97 	 * TLS, WTLS, WMLScript, SignText, etc..
    98 	 * 
    99 	 * @param aCertInfo The certificate to return applications for.
   100 	 * @param aAplications An array to save the applications in.
   101 	 * @param aStatus The request status object; contains the result of the
   102 	 *     Applications() request when complete. Set to KErrCancel if any
   103 	 *     outstanding request is cancelled.
   104 	 */
   105 	virtual void Applications(const CCTCertInfo& aCertInfo, RArray<TUid>& aAplications,
   106 							  TRequestStatus& aStatus) = 0;
   107 		
   108 	/** Cancels an ongoing Applications() operation. */
   109 	virtual void CancelApplications() = 0;
   110 	
   111 	/**
   112 	 * Tests if a certificate is applicable to a particular application.	
   113 	 * 
   114 	 * @param aCertInfo The certificate in question.
   115 	 * @param aApplication The application.
   116 	 * @param aIsApplicable Set to ETrue or EFalse by the function to return the result.
   117 	 * @param aStatus The request status object; contains the result of the
   118 	 *     IsApplicable() request when complete. Set to KErrCancel if any
   119 	 *     outstanding request is cancelled.
   120 	 */
   121 	virtual void IsApplicable(const CCTCertInfo& aCertInfo, TUid aApplication, 
   122 							  TBool& aIsApplicable, TRequestStatus& aStatus) = 0;
   123 
   124 	/** Cancels an ongoing IsApplicable() operation. */
   125 	virtual void CancelIsApplicable() = 0;
   126 
   127 	/**
   128 	 * Trust querying
   129 	 */
   130 	
   131 	/**
   132 	 * Tests whether a certificate is trusted.
   133 	 * 
   134 	 * Trust is only meaningful for CA certificates where it means that the
   135 	 * certificate can be used as a trust root for the purposes of certificate
   136 	 * validation.
   137 	 * 
   138 	 * @param aCertInfo The certificate we are interested in.
   139 	 * @param aTrusted Used to return the trust status.
   140 	 * @param aStatus The request status object; contains the result of the
   141 	 *     Trusted() request when complete. Set to KErrCancel if any outstanding
   142 	 *     request is cancelled.
   143 	 */
   144 	virtual void Trusted(const CCTCertInfo& aCertInfo, TBool& aTrusted, 
   145 						 TRequestStatus& aStatus) = 0;
   146 
   147 	/** Cancels an ongoing Trusted() operation. */
   148 	virtual void CancelTrusted() = 0;
   149 
   150 	/**
   151 	 * Retrieving the actual certificate
   152 	 */
   153 
   154 	/**
   155 	 * Retrieves the actual data of the certificate.	
   156 	 *
   157 	 * @param aCertInfo The certificate to retrieve.
   158 	 * @param aEncodedCert A buffer to put the certificate in. It must be big
   159 	 *     enough; the size is stored in aCertInfo.
   160 	 * @param aStatus The request status object; contains the result of the
   161 	 *     Retrieve()request when complete. Set to KErrCancel if any outstanding
   162 	 *     request is cancelled.
   163 	 *
   164 	 * @capability ReadUserData This requires the ReadUserData capability when
   165 	 *     applied to user certificates, as these may contain sensitive user data.
   166 	 * @leave KErrPermissionDenied If called for a user certificate when the
   167 	 *     caller doesn't have the ReadUserData capability.
   168 	 */
   169 	virtual void Retrieve(const CCTCertInfo& aCertInfo, TDes8& aEncodedCert, 
   170 						  TRequestStatus& aStatus) = 0;
   171 		
   172 	/** Cancels an ongoing Retrieve() operation. */
   173 	virtual void CancelRetrieve() = 0;
   174 		
   175 	};
   176 
   177 
   178 #endif