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