os/security/cryptomgmtlibs/cryptotokenfw/inc_interfaces/mctwritablecertstore_v2.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
* MCTWritableCertStore.h (v.2)
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
/**
sl@0
    21
 @file 
sl@0
    22
 @publishedPartner
sl@0
    23
 @released
sl@0
    24
*/
sl@0
    25
 
sl@0
    26
#ifndef __MCTWRITABLECERTSTORE_H__
sl@0
    27
#define __MCTWRITABLECERTSTORE_H__
sl@0
    28
sl@0
    29
#include <mctcertstore.h>
sl@0
    30
sl@0
    31
/**
sl@0
    32
 * The UID of writeable certificate store interfaces.
sl@0
    33
 *
sl@0
    34
 * A token that supports this interface should also support the read-only certificate 
sl@0
    35
 * store interface.
sl@0
    36
 */
sl@0
    37
const TInt KInterfaceWritableCertStore = 0x102020FB; // new version, since 9.0
sl@0
    38
sl@0
    39
/**
sl@0
    40
 * Defines the interface for a writeable certificate store token.
sl@0
    41
 * 
sl@0
    42
 * This extends the read-only certificate store API in MCTCertStore by adding 
sl@0
    43
 * functions to add and delete certificates, and to set their applicability and 
sl@0
    44
 * trust settings. 
sl@0
    45
 *
sl@0
    46
 * This documentation describes the security policy that must be enforced by
sl@0
    47
 * implementations of the interface.
sl@0
    48
 * 
sl@0
    49
 * @publishedPartner
sl@0
    50
 * @released
sl@0
    51
 */
sl@0
    52
class MCTWritableCertStore : public MCTCertStore
sl@0
    53
	{
sl@0
    54
public:
sl@0
    55
	/**
sl@0
    56
	 * Adding a certificate
sl@0
    57
	 */
sl@0
    58
sl@0
    59
	/**
sl@0
    60
	 * Adds a certificate to the store.
sl@0
    61
	 * 
sl@0
    62
	 * This is an asynchronous request.	
sl@0
    63
	 * 
sl@0
    64
	 * @param aLabel				The label of the certificate to add.
sl@0
    65
	 * @param aFormat				The format of the certificate.
sl@0
    66
	 * @param aCertificateOwnerType	The owner type.
sl@0
    67
	 * @param aSubjectKeyId			The Subject key ID.
sl@0
    68
	 * @param aIssuerKeyId			The issuer key ID.
sl@0
    69
	 * @param aCert					The certificate to be added.
sl@0
    70
	 * @param aStatus				The request status object; contains the result of the Add() 
sl@0
    71
	 * 								request when complete. Set to KErrCancel, if an outstanding 
sl@0
    72
	 * 								request is cancelled.
sl@0
    73
	 *
sl@0
    74
	 * @capability WriteUserData	This requires the WriteUserData capability when
sl@0
    75
	 *								applied to user certificates.
sl@0
    76
	 * @capability WriteDeviceData	This requires the WriteDeviceData capability
sl@0
    77
	 *								when applied to CA certificates.
sl@0
    78
	 * @leave KErrPermissionDenied	If the caller doesn't have the required capabilities.
sl@0
    79
	 */
sl@0
    80
	virtual void Add(const TDesC& aLabel, TCertificateFormat aFormat,
sl@0
    81
					 TCertificateOwnerType aCertificateOwnerType, 
sl@0
    82
					 const TKeyIdentifier* aSubjectKeyId,
sl@0
    83
					 const TKeyIdentifier* aIssuerKeyId,
sl@0
    84
					 const TDesC8& aCert, TRequestStatus& aStatus) = 0;
sl@0
    85
		
sl@0
    86
	/** Cancels an ongoing Add() operation. */
sl@0
    87
	virtual void CancelAdd() = 0;
sl@0
    88
sl@0
    89
	/**
sl@0
    90
	 * Removing Certificates
sl@0
    91
	 */
sl@0
    92
	
sl@0
    93
	/**
sl@0
    94
	 * Removes a certificate.
sl@0
    95
	 * 
sl@0
    96
	 * @param aCertInfo	The certificate to be removed.
sl@0
    97
	 * @param aStatus	The request status object; contains the result of the Remove() 
sl@0
    98
	 * 					request when complete. Set to KErrCancel, if an outstanding request is cancelled.
sl@0
    99
	 *
sl@0
   100
	 * @capability WriteUserData	This requires the WriteUserData capability when
sl@0
   101
	 *								applied to user certificates.
sl@0
   102
	 * @capability WriteDeviceData	This requires the WriteDeviceData capability
sl@0
   103
	 *								when applied to CA certificates.
sl@0
   104
	 * @leave KErrPermissionDenied	If the caller doesn't have the required capabilities.
sl@0
   105
	 */
sl@0
   106
	virtual void Remove(const CCTCertInfo& aCertInfo, TRequestStatus& aStatus) = 0;
sl@0
   107
sl@0
   108
	/** Cancels an ongoing Remove() operation. */
sl@0
   109
	virtual void CancelRemove() = 0;
sl@0
   110
sl@0
   111
	/**
sl@0
   112
	 * Setting applicability
sl@0
   113
	 */
sl@0
   114
		
sl@0
   115
	/**
sl@0
   116
	 * Replaces the current applicability settings with the settings in the
sl@0
   117
	 * supplied array.
sl@0
   118
	 * 
sl@0
   119
	 * This should only be called for CA certificates - it has no meaning for
sl@0
   120
	 * user certificates.
sl@0
   121
	 * 
sl@0
   122
	 * If this function is called by the unified certstore the given application
sl@0
   123
	 * uids array is guaranteed not to contain duplicates. However, client
sl@0
   124
	 * applications may bypass the unified certstore and call this function
sl@0
   125
	 * directly, in that case the array passed might contain duplicates.
sl@0
   126
	 * 
sl@0
   127
	 * @param aCertInfo		The certificate whose applicability should be updated.
sl@0
   128
	 * @param aApplications	The new applicability settings. Ownership of this
sl@0
   129
	 * 						remains with the caller, and it must remain valid for the
sl@0
   130
	 * 						lifetime of the call.
sl@0
   131
	 * @param aStatus		The request status object; contains the result of the SetApplicability() 
sl@0
   132
	 * 						request when complete. Set to KErrCancel, if an outstanding request is cancelled.
sl@0
   133
	 *
sl@0
   134
	 * @capability WriteDeviceData	This requires the WriteDeviceData capability.
sl@0
   135
	 * @leave KErrPermissionDenied	If the caller doesn't have the required capabilities.
sl@0
   136
	 */
sl@0
   137
	virtual void SetApplicability(const CCTCertInfo& aCertInfo, 
sl@0
   138
						  const RArray<TUid>& aApplications, TRequestStatus &aStatus) = 0;
sl@0
   139
sl@0
   140
	/** Cancels an ongoing SetApplicability() operation. */
sl@0
   141
	virtual void CancelSetApplicability() = 0;
sl@0
   142
sl@0
   143
	/**
sl@0
   144
	 * Changing trust settings
sl@0
   145
	 */
sl@0
   146
sl@0
   147
	/**
sl@0
   148
	 * Changes the trust settings.
sl@0
   149
	 * 
sl@0
   150
	 * A CA certificate is trusted if the user is willing to use it for authenticating 
sl@0
   151
	 * servers. It has no meaning with other types of certificates.
sl@0
   152
	 * 
sl@0
   153
	 * @param aCertInfo	The certificate to be updated.
sl@0
   154
	 * @param aTrusted	ETrue, if trusted; EFalse, otherwise.
sl@0
   155
	 * @param aStatus	The request status object; contains the result of the SetTrust() 
sl@0
   156
	 * 					request when complete. Set to KErrCancel, if an outstanding request is cancelled.
sl@0
   157
	 *
sl@0
   158
	 * @capability WriteDeviceData	This requires the WriteDeviceData capability.
sl@0
   159
	 * @leave KErrPermissionDenied	If the caller doesn't have the required capabilities.
sl@0
   160
	 */
sl@0
   161
	virtual void SetTrust(const CCTCertInfo& aCertInfo, TBool aTrusted, 
sl@0
   162
						  TRequestStatus& aStatus) = 0;
sl@0
   163
sl@0
   164
	/** Cancels an ongoing SetTrust() operation. */
sl@0
   165
	virtual void CancelSetTrust() = 0;
sl@0
   166
			
sl@0
   167
	/**
sl@0
   168
	 * Adding a certificate
sl@0
   169
	 */
sl@0
   170
	
sl@0
   171
	/**
sl@0
   172
	 * Same as original Add() method above, but with additional parameter TBool aDeletable.
sl@0
   173
	 *
sl@0
   174
	 * @param aLabel				The label of the certificate to add.
sl@0
   175
	 * @param aFormat				The format of the certificate.
sl@0
   176
	 * @param aCertificateOwnerType	The owner type.
sl@0
   177
	 * @param aSubjectKeyId			The Subject key ID.
sl@0
   178
	 * @param aIssuerKeyId			The issuer key ID.
sl@0
   179
	 * @param aCert					The certificate to be added.
sl@0
   180
	 * 
sl@0
   181
	 * @param aDeletable			Sets the value for the certificate's deletable flag
sl@0
   182
	 * 									= true 	- means it is permitted to remove the
sl@0
   183
	 *												certificate from certstore
sl@0
   184
	 * 									= false - means the certificate is NOT deletable.
sl@0
   185
	 *
sl@0
   186
	 * @param aStatus				The request status object;
sl@0
   187
	 * 								contains the result of the Add() request when complete. 
sl@0
   188
	 *								Two of possible error values:
sl@0
   189
	 *									= KErrCancel, if an outstanding request is cancelled;
sl@0
   190
	 *									= KErrNotSupported (-5), if the method is called from a
sl@0
   191
	 *										child class that doesn't support implementation of
sl@0
   192
	 *										the new Add() method.
sl@0
   193
	 *
sl@0
   194
	 * @capability WriteUserData	This requires the WriteUserData capability when
sl@0
   195
	 *								applied to user certificates.
sl@0
   196
	 * @capability WriteDeviceData	This requires the WriteDeviceData capability
sl@0
   197
	 *								when applied to CA certificates.
sl@0
   198
	 * @leave KErrPermissionDenied	If the caller doesn't have the required capabilities.
sl@0
   199
	 */
sl@0
   200
	virtual void Add(const TDesC& aLabel, TCertificateFormat aFormat,
sl@0
   201
					 TCertificateOwnerType aCertificateOwnerType, 
sl@0
   202
					 const TKeyIdentifier* aSubjectKeyId,
sl@0
   203
					 const TKeyIdentifier* aIssuerKeyId,
sl@0
   204
					 const TDesC8& aCert, 
sl@0
   205
					 const TBool aDeletable,
sl@0
   206
					 TRequestStatus& aStatus );
sl@0
   207
	
sl@0
   208
	};
sl@0
   209
sl@0
   210
sl@0
   211
#include <mctwritablecertstore.inl>
sl@0
   212
sl@0
   213
#endif