Class Context

Definition

Namespace:
Tizen.Security.TEEC
Assembly:
Tizen.Security.TEEC.dll
API Level:
3

This type denotes a TEE Context, the main logical container linking a Client Application with a particular TEE.

C#
Copy
public sealed class Context : IDisposable
Inheritance
System.Object
Context
Implements
System.IDisposable

Constructors

View Source

Context(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
C#
Copy
public Context(string name)
Parameters
Type Name Description
System.String name

The TEE name.

Exceptions
Type Condition
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.

API Level: 3
Privilege Level: partner
Privilege: http://tizen.org/privilege/tee.client
Feature: http://tizen.org/feature/security.tee

Methods

View Source

AllocateSharedMemory(UInt32, 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
C#
Copy
public SharedMemory AllocateSharedMemory(uint size, SharedMemoryFlags flags)
Parameters
Type Name Description
System.UInt32 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
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.

API Level: 3
Privilege Level: partner
Privilege: http://tizen.org/privilege/tee.client
Feature: http://tizen.org/feature/security.tee
View Source

Dispose()

This function implements the IDisposable interface.

Declaration
C#
Copy
public void Dispose()
API Level: 3
Privilege Level: partner
Privilege: http://tizen.org/privilege/tee.client
Feature: http://tizen.org/feature/security.tee
View Source

Finalize()

Destructor of the class.

Declaration
C#
Copy
protected void Finalize()
View Source

OpenSession(Guid)

@see OpenSession (Guid destination, uint connectionMethod, byte[] connectionData, Parameter[] paramlist, CancellationToken token).

Declaration
C#
Copy
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
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.

API Level: 3
Privilege Level: partner
Privilege: http://tizen.org/privilege/tee.client
Feature: http://tizen.org/feature/security.tee
View Source

OpenSession(Guid, UInt32, 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
C#
Copy
public Session OpenSession(Guid destination, uint loginMethod, byte[] connectionData, Parameter[] paramlist)
Parameters
Type Name Description
System.Guid destination

The UUID of the destination TA.

System.UInt32 loginMethod

The authentication algorithm LoginMethod.

System.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
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.

API Level: 3
Privilege Level: partner
Privilege: http://tizen.org/privilege/tee.client
Feature: http://tizen.org/feature/security.tee
View Source

OpenSessionAsync(Guid, CancellationToken)

The asynchronous version of the OpenSession. @see OpenSession (Guid destination, uint connectionMethod, byte[] connectionData, Parameter[] paramlist, CancellationToken token).

Declaration
C#
Copy
public Task<Session> OpenSessionAsync(Guid destination, CancellationToken token = default(CancellationToken))
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<Session>

Returns a task executing session open in the background.

Exceptions
Type Condition
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.

API Level: 3
Privilege Level: partner
Privilege: http://tizen.org/privilege/tee.client
Feature: http://tizen.org/feature/security.tee
View Source

OpenSessionAsync(Guid, UInt32, Byte[], Parameter[], CancellationToken)

The asynchronous version of the OpenSession. @see OpenSession (Guid destination, uint connectionMethod, byte[] connectionData, Parameter[] paramlist, CancellationToken token).

Declaration
C#
Copy
public Task<Session> OpenSessionAsync(Guid destination, uint loginMethod, byte[] connectionData, Parameter[] paramlist, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
System.Guid destination

The UUID of the destination TA.

System.UInt32 loginMethod

The authentication algorithm LoginMethod.

System.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<Session>

Returns a Task executing the session open in the background.

Exceptions
Type Condition
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.

API Level: 3
Privilege Level: partner
Privilege: http://tizen.org/privilege/tee.client
Feature: http://tizen.org/feature/security.tee
View Source

RegisterSharedMemory(IntPtr, UInt32, 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
C#
Copy
public SharedMemory RegisterSharedMemory(IntPtr memaddr, uint size, SharedMemoryFlags flags)
Parameters
Type Name Description
System.IntPtr memaddr

The address of the shared memory.

System.UInt32 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
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 memaddr is wrong.

API Level: 3
Privilege Level: partner
Privilege: http://tizen.org/privilege/tee.client
Feature: http://tizen.org/feature/security.tee
View Source

ReleaseSharedMemory(SharedMemory)

This function deregisters or deallocates a previously initialized block of the shared memory.

Declaration
C#
Copy
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
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.

API Level: 3
Privilege Level: partner
Privilege: http://tizen.org/privilege/tee.client
Feature: http://tizen.org/feature/security.tee

Implements

System.IDisposable