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