load

fun load(context: Context, uri: Uri, heldRoots: List<TrustAnchor>): TrustAnchorLoad

Reads the root certificates behind uri, the content address the Storage Access Framework (the system file picker) gives your app, through the content resolver of context. The stream is opened and closed here; the bytes go to load. Android only.

Call it off the main thread: it reads the whole content. Nothing is fetched from the network: an address that starts with http:// or https:// is answered with TrustAnchorLoadProblem.NOT_A_LOCAL_FILE without being opened, and the app downloads the file itself. Content larger than 16 MiB is answered with TrustAnchorLoadProblem.TOO_LARGE. Never throws: every failure is a typed TrustAnchorLoad.problem.

Since

1.0.0

Parameters

context

Any context of the app.

uri

The content address of the file the person picked.

heldRoots

Roots the app already holds, used only for a master list's own checks, as in load on bytes.


As load on a content address, with no held roots.


Reads root certificates from bytes. The content is worked out from the bytes alone, never from a file name. Never throws for bad input: every failure is a typed TrustAnchorLoad.problem.

Return

TrustAnchorLoad with what could be read, what could not, and what the content is.


actual fun load(bytes: ByteArray, heldRoots: List<TrustAnchor>): TrustAnchorLoad

Reads root certificates from bytes, as load does, and checks a master list's own signature against heldRoots: root certificates the app already holds (for example from an earlier load). With none, that check reports that it did not run (TrustAnchorLoadKind.MASTER_LIST only; other content has no signature to check).

The roots in heldRoots are not added to TrustAnchorLoad.anchors: merge the loads you want to trust with TrustAnchorLoad.plus. Who is to be trusted stays the app's choice.

Return

TrustAnchorLoad with what could be read, what could not, and what the content is.

Since

1.0.0

Parameters

heldRoots

Roots the app already holds, used only for the master list's own checks.

Reads root certificates from bytes. The content is worked out from the bytes alone, never from a file name. Never throws for bad input: every failure is a typed TrustAnchorLoad.problem.

Return

TrustAnchorLoad with what could be read, what could not, and what the content is.


expect fun load(bytes: ByteArray, heldRoots: List<TrustAnchor>): TrustAnchorLoad

Reads root certificates from bytes, as load does, and checks a master list's own signature against heldRoots: root certificates the app already holds (for example from an earlier load). With none, that check reports that it did not run (TrustAnchorLoadKind.MASTER_LIST only; other content has no signature to check).

The roots in heldRoots are not added to TrustAnchorLoad.anchors: merge the loads you want to trust with TrustAnchorLoad.plus. Who is to be trusted stays the app's choice.

Return

TrustAnchorLoad with what could be read, what could not, and what the content is.

Since

1.0.0

Parameters

heldRoots

Roots the app already holds, used only for the master list's own checks.

Reads the local file at path, so a Swift caller can pass url.path. The SDK never downloads: a string that starts with http:// or https:// is answered with TrustAnchorLoadProblem.NOT_A_LOCAL_FILE and nothing is fetched, and the app downloads the file itself and passes the local path. A file larger than 16 MiB is answered with TrustAnchorLoadProblem.TOO_LARGE before it is read into memory; a real master list is about 1 MB. Never throws.


fun load(path: String, heldRoots: List<TrustAnchor>): TrustAnchorLoad

As load on a path, with heldRoots for a master list's own checks.


actual fun load(bytes: ByteArray): TrustAnchorLoad

Reads root certificates from bytes. The content is worked out from the bytes alone, never from a file name. Never throws for bad input: every failure is a typed TrustAnchorLoad.problem.

Return

TrustAnchorLoad with what could be read, what could not, and what the content is.


actual fun load(bytes: ByteArray, heldRoots: List<TrustAnchor>): TrustAnchorLoad

Reads root certificates from bytes, as load does, and checks a master list's own signature against heldRoots: root certificates the app already holds (for example from an earlier load). With none, that check reports that it did not run (TrustAnchorLoadKind.MASTER_LIST only; other content has no signature to check).

The roots in heldRoots are not added to TrustAnchorLoad.anchors: merge the loads you want to trust with TrustAnchorLoad.plus. Who is to be trusted stays the app's choice.

Return

TrustAnchorLoad with what could be read, what could not, and what the content is.

Since

1.0.0

Parameters

heldRoots

Roots the app already holds, used only for the master list's own checks.

Reads root certificates from bytes. The content is worked out from the bytes alone, never from a file name. Never throws for bad input: every failure is a typed TrustAnchorLoad.problem.

Return

TrustAnchorLoad with what could be read, what could not, and what the content is.


actual fun load(bytes: ByteArray, heldRoots: List<TrustAnchor>): TrustAnchorLoad

Reads root certificates from bytes, as load does, and checks a master list's own signature against heldRoots: root certificates the app already holds (for example from an earlier load). With none, that check reports that it did not run (TrustAnchorLoadKind.MASTER_LIST only; other content has no signature to check).

The roots in heldRoots are not added to TrustAnchorLoad.anchors: merge the loads you want to trust with TrustAnchorLoad.plus. Who is to be trusted stays the app's choice.

Return

TrustAnchorLoad with what could be read, what could not, and what the content is.

Since

1.0.0

Parameters

heldRoots

Roots the app already holds, used only for the master list's own checks.