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