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