callEnclave

byte[] callEnclave(byte[] bytes, Function<byte[], byte[]> callback)

Passes the given byte array to the enclave. The format of the byte arrays are up to you but will typically use some sort of serialization mechanism, alternatively, DataOutputStream is a convenient way to lay out pieces of data in a fixed order.

For this method to work the enclave class must override and implement receiveFromUntrustedHost The return value from that method (which can be null) is returned here. It will not be received via the provided callback.

With the provided callback the enclave also has the option of using Enclave.callUntrustedHost and sending/receiving byte arrays in the opposite direction. By chaining callbacks together, a kind of virtual stack can be constructed allowing complex back-and-forth conversations between enclave and untrusted host.

Any uncaught exceptions thrown by receiveFromUntrustedHost will propagate across the enclave-host boundary and will be rethrown here.

Return

The return value of the enclave's receiveFromUntrustedHost.

Parameters

bytes

Bytes to send to the enclave.

callback

Bytes received from the enclave via Enclave.callUntrustedHost.

Throws

If the enclave has not provided an implementation of receiveFromUntrustedHost.

If the host has not been started.

byte[] callEnclave(byte[] bytes)

Passes the given byte array to the enclave. The format of the byte arrays are up to you but will typically use some sort of serialization mechanism, alternatively, DataOutputStream is a convenient way to lay out pieces of data in a fixed order.

For this method to work the enclave class must override and implement receiveFromUntrustedHost The return value from that method (which can be null) is returned here. It will not be received via the provided callback.

The enclave does not have the option of using Enclave.callUntrustedHost for sending bytes back to the host. Use the overload which takes in a callback Function instead.

Any uncaught exceptions thrown by receiveFromUntrustedHost will propagate across the enclave-host boundary and will be rethrown here.

Return

The return value of the enclave's receiveFromUntrustedHost.

Parameters

bytes

Bytes to send to the enclave.

Throws

If the enclave has not provided an implementation of receiveFromUntrustedHost.

If the host has not been started.