1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptomgmtlibs/cryptotokenfw/inc/ct/tcttokenobjecthandle.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,113 @@
1.4 +/*
1.5 +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedAll
1.25 + @released
1.26 +*/
1.27 +
1.28 +#ifndef __TCTTOKENOBJECTHANDLE_H__
1.29 +#define __TCTTOKENOBJECTHANDLE_H__
1.30 +
1.31 +#include <e32std.h>
1.32 +#include <ct/tcttokenhandle.h>
1.33 +
1.34 +
1.35 +/**
1.36 + * Defines a handle to an object represented by a class which is a subclass of
1.37 + * the MCTTokenObject class.
1.38 + *
1.39 + * The handle identifies the object, not the instance of the subclass of MCTTokenObject
1.40 + * used to manage that object. It is guaranteed to be unique within the context
1.41 + * of a specific device (e.g. mobile phone, etc.) at a specific point in time.
1.42 + * This limitation in time is due to the fact that objects can be created and
1.43 + * destroyed. We cannot guarantee that a handle will still point to the same
1.44 + * object after we add or remove one or more objects from the store from which
1.45 + * the object comes. However, it is guaranteed that the addition of objects to
1.46 + * the store will not affect the validity of the handles that were obtained previously.
1.47 + * For instance, if the object is a certificate in a certificate store, the subclass
1.48 + * of MCTTokenObject will be CCTCertInfo and the handle will identify the certificate
1.49 + * in the certificate store, not the instance of CCTCertInfo.
1.50 + *
1.51 + * The handle is especially useful for communication across process boundaries.
1.52 + * For example: a process (A) can get a handle to an object, and then give the handle
1.53 + * to another process (B). This process (B) can then try to get the same object using that handle.
1.54 + *
1.55 + * @since v7.0
1.56 + */
1.57 +class TCTTokenObjectHandle
1.58 + {
1.59 +public:
1.60 + /**
1.61 + * Creates an invalid handle.
1.62 + *
1.63 + * An invalid handle has an invalid iTokenHandle and an iObjectId equal to 0.
1.64 + */
1.65 + IMPORT_C TCTTokenObjectHandle();
1.66 +
1.67 + /**
1.68 + * Creates a handle.
1.69 + *
1.70 + * @param aTokenHandle The handle that identifies the Token where the object
1.71 + * is stored.
1.72 + * @param aObjectId The identifier of the object within the Token.
1.73 + */
1.74 + IMPORT_C TCTTokenObjectHandle(TCTTokenHandle aTokenHandle, TInt aObjectId);
1.75 +
1.76 + /**
1.77 + * Copy Constructor.
1.78 + *
1.79 + * @param aTokenHandle The handle to copy.
1.80 + */
1.81 + IMPORT_C TCTTokenObjectHandle(const TCTTokenObjectHandle& aTokenHandle);
1.82 +
1.83 + /**
1.84 + * Equality operator.
1.85 + *
1.86 + * Tests whether this TCTTokenObjectHandle object is equal to the specified
1.87 + * TCTTokenObjectHandle object.
1.88 + *
1.89 + * @param aTokenHandle The TCTTokenObjectHandle object to be compared.
1.90 + * @return ETrue, if thisTCTTokenObjectHandle object is equal to
1.91 + * the specified TCTTokenObjectHandle object; EFalse otherwise.
1.92 + */
1.93 + IMPORT_C TBool operator ==(const TCTTokenObjectHandle& aTokenHandle) const;
1.94 +
1.95 + /** Inequality operator */
1.96 + inline TBool operator !=(const TCTTokenObjectHandle& aTokenHandle) const;
1.97 +
1.98 + public:
1.99 + /** The handle that identifies the Token where the object is stored. */
1.100 + TCTTokenHandle iTokenHandle;
1.101 +
1.102 + /**
1.103 + * The identifier of the object within the Token.
1.104 + *
1.105 + * This is unique within the context of a particular Token and only at a specific
1.106 + * point in time.
1.107 + */
1.108 + TInt iObjectId;
1.109 + };
1.110 +
1.111 +inline TBool TCTTokenObjectHandle::operator !=(const TCTTokenObjectHandle& aHandle) const
1.112 + {
1.113 + return !(*this == aHandle);
1.114 + }
1.115 +
1.116 +#endif