Class Context
Definition
- Assembly:
- Tizen.Security.TEEC.dll
This type denotes a TEE Context, the main logical container linking a Client Application with a particular TEE.
public sealed class Context : IDisposable
- Inheritance
-
objectContext
- Implements
-
System.IDisposable
Constructors
View SourceContext(string)
This function (constructor) initializes a new TEE Context, forming a connection between this client application and the TEE identified by the string identifier name (empty or null name denotes a default TEE).
Declaration
public Context(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The TEE name. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | Thrown when an application does not have the privilege to access this method. |
System.NotSupportedException | The required feature is not supported. |
System.InvalidOperationException | The operation is invalid. |
Methods
View SourceAllocateSharedMemory(uint, SharedMemoryFlags)
This function allocates a new block of memory as a block of shared memory within the scope of the specified context, in accordance with the parameters.
Declaration
public SharedMemory AllocateSharedMemory(uint size, SharedMemoryFlags flags)
Parameters
Type | Name | Description |
---|---|---|
uint | size | The size of shared memory. |
SharedMemoryFlags | flags | The flags describing access modes (Input and/or Output). |
Returns
Type | Description |
---|---|
SharedMemory | Returns the Shared Memory handler. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | Thrown when an application does not have the privilege to access this method. |
System.NotSupportedException | The required feature is not supported. |
System.InvalidOperationException | The operation is invalid. |
Dispose()
This function implements the IDisposable interface.
Declaration
public void Dispose()
~Context()
Destructor of the class.
Declaration
protected ~Context()
OpenSession(Guid, uint, byte[], Parameter[])
This function opens a new session between the client application and the specified trusted application.
The target trusted application is identified by an UUID passed in the parameter destination.
There can be up to four parameter objects given in the paramlist
array.
Declaration
public Session OpenSession(Guid destination, uint loginMethod, byte[] connectionData, Parameter[] paramlist)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | destination | The UUID of the destination TA. |
uint | loginMethod | The authentication algorithm LoginMethod. |
byte[] | connectionData | The data to be verified by a given login method. |
Parameter[] | paramlist | The parameters to be passed to TA open-session-callback. |
Returns
Type | Description |
---|---|
Session | Returns opened session. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | Thrown when an application does not have the privilege to access this method. |
System.NotSupportedException | The required feature is not supported. |
System.InvalidOperationException | The operation is invalid. |
System.ArgumentException | One of the arguments is wrong. |
OpenSession(Guid)
@see OpenSession (Guid destination, uint connectionMethod, byte[] connectionData, Parameter[] paramlist, CancellationToken token).
Declaration
public Session OpenSession(Guid destination)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | destination | The UUID of the destination TA. |
Returns
Type | Description |
---|---|
Session | Returns opened session. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | Thrown when an application does not have the privilege to access this method. |
System.NotSupportedException | The required feature is not supported. |
System.InvalidOperationException | The operation is invalid. |
OpenSessionAsync(Guid, CancellationToken)
The asynchronous version of the OpenSession. @see OpenSession (Guid destination, uint connectionMethod, byte[] connectionData, Parameter[] paramlist, CancellationToken token).
Declaration
public Task<Session> OpenSessionAsync(Guid destination, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | destination | The UUID of the destination TA. |
System.Threading.CancellationToken | token | The token for a task manipulation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><Session> | Returns a task executing session open in the background. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | Thrown when an application does not have the privilege to access this method. |
System.NotSupportedException | The required feature is not supported. |
System.InvalidOperationException | The operation is invalid. |
OpenSessionAsync(Guid, uint, byte[], Parameter[], CancellationToken)
The asynchronous version of the OpenSession. @see OpenSession (Guid destination, uint connectionMethod, byte[] connectionData, Parameter[] paramlist, CancellationToken token).
Declaration
public Task<Session> OpenSessionAsync(Guid destination, uint loginMethod, byte[] connectionData, Parameter[] paramlist, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | destination | The UUID of the destination TA. |
uint | loginMethod | The authentication algorithm LoginMethod. |
byte[] | connectionData | The data to be verified by a given login method. |
Parameter[] | paramlist | The parameters to be passed to the TA open-session-callback. |
System.Threading.CancellationToken | token | The token for the task manipulation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><Session> | Returns a Task executing the session open in the background. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | Thrown when an application does not have the privilege to access this method. |
System.NotSupportedException | The required feature is not supported. |
System.InvalidOperationException | The operation is invalid. |
System.ArgumentException | One of the arguments is wrong. |
RegisterSharedMemory(IntPtr, uint, SharedMemoryFlags)
This function registers a block of the existing client application memory as a block of shared memory within
the scope of the specified context, in accordance with the parameters.
The input memaddr
must point to the shared memory region to register.
Declaration
public SharedMemory RegisterSharedMemory(IntPtr memaddr, uint size, SharedMemoryFlags flags)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | memaddr | The address of the shared memory. |
uint | size | The size of the shared memory. |
SharedMemoryFlags | flags | The flags describing the access modes (Input and/or Output). |
Returns
Type | Description |
---|---|
SharedMemory | Returns the SharedMemory handler. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | Thrown when an application does not have the privilege to access this method. |
System.NotSupportedException | The required feature is not supported. |
System.InvalidOperationException | The operation is invalid. |
System.ArgumentException | The argument |
ReleaseSharedMemory(SharedMemory)
This function deregisters or deallocates a previously initialized block of the shared memory.
Declaration
public void ReleaseSharedMemory(SharedMemory shm)
Parameters
Type | Name | Description |
---|---|---|
SharedMemory | shm | The shared memory object returned by RegisterSharedMemory or AllocateSharedMemory. |
Remarks
For a memory buffer allocated using AllocateSharedMemory, the implementation must free the underlying memory and the client application must not access this region after this function has been called. In this case, the implementation must clear the buffer and size fields of the shared memory structure before returning. For memory registered using RegisterSharedMemory, the implementation must deregister the underlying memory from the TEE, but the memory region will stay available to the client application for other purposes as the memory is owned by it.
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | Thrown when an application does not have the privilege to access this method. |
System.NotSupportedException | The required feature is not supported. |
System.InvalidOperationException | The operation is invalid. |
System.ArgumentException | The argument is wrong. |