TrustAnchors

Reads root certificates (trust anchors) from content the app already has, in one call, so the app does not need to know the file formats: what a master list is, what DER and PEM are, or which file extension means what.

load works the content out from the bytes alone, never from a file name, in this order: a CSCA master list (CMS SignedData with the ICAO master list content type), one certificate in DER, PEM text holding one or many certificates, then several certificates in DER one after another. Nothing readable is thrown away when some items are unreadable: TrustAnchorLoad.anchors holds every certificate that could be read and TrustAnchorLoad.unreadable reports each item that could not, with its position.

The SDK never downloads or bundles root certificates, and it does not decide whether a master list or any root in it is to be trusted: that is the app's choice. Who signed a master list is not verified by this helper: the list's own checks ride along in TrustAnchorLoad.masterList for the app to read and judge, exactly as MasterListReader reports them.

The file helpers (load on a java.io.File or java.io.InputStream on the JVM and Android, load on a path on iOS) read a local file only. 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.

Usage (Kotlin):

val loaded = TrustAnchors.load(bytes) // load(file) on the JVM and Android, load(path) on iOS
if (loaded.problem != null) {
// record the problem and no anchors were read
}
val options = ChipReadOptions(accessKey, trustAnchors = loaded.anchors)

Experimental: see ExperimentalTesseraChipApi.

Since

1.0.0

Reads root certificates (trust anchors) from content the app already has, in one call, so the app does not need to know the file formats: what a master list is, what DER and PEM are, or which file extension means what.

load works the content out from the bytes alone, never from a file name, in this order: a CSCA master list (CMS SignedData with the ICAO master list content type), one certificate in DER, PEM text holding one or many certificates, then several certificates in DER one after another. Nothing readable is thrown away when some items are unreadable: TrustAnchorLoad.anchors holds every certificate that could be read and TrustAnchorLoad.unreadable reports each item that could not, with its position.

The SDK never downloads or bundles root certificates, and it does not decide whether a master list or any root in it is to be trusted: that is the app's choice. Who signed a master list is not verified by this helper: the list's own checks ride along in TrustAnchorLoad.masterList for the app to read and judge, exactly as MasterListReader reports them.

The file helpers (load on a java.io.File or java.io.InputStream on the JVM and Android, load on a path on iOS) read a local file only. 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.

Usage (Kotlin):

val loaded = TrustAnchors.load(bytes) // load(file) on the JVM and Android, load(path) on iOS
if (loaded.problem != null) {
// record the problem and no anchors were read
}
val options = ChipReadOptions(accessKey, trustAnchors = loaded.anchors)

Experimental: see ExperimentalTesseraChipApi.

Since

1.0.0

Reads root certificates (trust anchors) from content the app already has, in one call, so the app does not need to know the file formats: what a master list is, what DER and PEM are, or which file extension means what.

load works the content out from the bytes alone, never from a file name, in this order: a CSCA master list (CMS SignedData with the ICAO master list content type), one certificate in DER, PEM text holding one or many certificates, then several certificates in DER one after another. Nothing readable is thrown away when some items are unreadable: TrustAnchorLoad.anchors holds every certificate that could be read and TrustAnchorLoad.unreadable reports each item that could not, with its position.

The SDK never downloads or bundles root certificates, and it does not decide whether a master list or any root in it is to be trusted: that is the app's choice. Who signed a master list is not verified by this helper: the list's own checks ride along in TrustAnchorLoad.masterList for the app to read and judge, exactly as MasterListReader reports them.

The file helpers (load on a java.io.File or java.io.InputStream on the JVM and Android, load on a path on iOS) read a local file only. 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.

Usage (Kotlin):

val loaded = TrustAnchors.load(bytes) // load(file) on the JVM and Android, load(path) on iOS
if (loaded.problem != null) {
// record the problem and no anchors were read
}
val options = ChipReadOptions(accessKey, trustAnchors = loaded.anchors)

Experimental: see ExperimentalTesseraChipApi.

Since

1.0.0

Reads root certificates (trust anchors) from content the app already has, in one call, so the app does not need to know the file formats: what a master list is, what DER and PEM are, or which file extension means what.

load works the content out from the bytes alone, never from a file name, in this order: a CSCA master list (CMS SignedData with the ICAO master list content type), one certificate in DER, PEM text holding one or many certificates, then several certificates in DER one after another. Nothing readable is thrown away when some items are unreadable: TrustAnchorLoad.anchors holds every certificate that could be read and TrustAnchorLoad.unreadable reports each item that could not, with its position.

The SDK never downloads or bundles root certificates, and it does not decide whether a master list or any root in it is to be trusted: that is the app's choice. Who signed a master list is not verified by this helper: the list's own checks ride along in TrustAnchorLoad.masterList for the app to read and judge, exactly as MasterListReader reports them.

The file helpers (load on a java.io.File or java.io.InputStream on the JVM and Android, load on a path on iOS) read a local file only. 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.

Usage (Kotlin):

val loaded = TrustAnchors.load(bytes) // load(file) on the JVM and Android, load(path) on iOS
if (loaded.problem != null) {
// record the problem and no anchors were read
}
val options = ChipReadOptions(accessKey, trustAnchors = loaded.anchors)

Experimental: see ExperimentalTesseraChipApi.

Since

1.0.0

Functions

Link copied to clipboard

Reads file, a local file the app obtained itself (the SDK never downloads), and hands its bytes to load. A file larger than 16 MiB is answered with TrustAnchorLoadProblem.TOO_LARGE before it is read into memory. A path that starts with http:// or https:// is answered with TrustAnchorLoadProblem.NOT_A_LOCAL_FILE and nothing is fetched; a java.io.File keeps such a path with its double slash collapsed to one, and that form counts too. Never throws.

Reads stream to its end and hands the bytes to load. The stream is not closed. With more than 16 MiB in it the read stops after the cap and the answer is TrustAnchorLoadProblem.TOO_LARGE. An I/O failure is answered with TrustAnchorLoadProblem.NOT_READABLE. Never throws.

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.

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

As load on a file, with heldRoots for a master list's own checks; see the bytes form.

As load on a stream, with heldRoots for a master list's own checks; see the bytes form.

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

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.

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.

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

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.

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.

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

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

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

Reads file, a local file the app obtained itself (the SDK never downloads), and hands its bytes to load. A file larger than 16 MiB is answered with TrustAnchorLoadProblem.TOO_LARGE before it is read into memory. A path that starts with http:// or https:// is answered with TrustAnchorLoadProblem.NOT_A_LOCAL_FILE and nothing is fetched; a java.io.File keeps such a path with its double slash collapsed to one, and that form counts too. Never throws.

Reads stream to its end and hands the bytes to load. The stream is not closed. With more than 16 MiB in it the read stops after the cap and the answer is TrustAnchorLoadProblem.TOO_LARGE. An I/O failure is answered with TrustAnchorLoadProblem.NOT_READABLE. Never throws.

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.

As load on a file, with heldRoots for a master list's own checks; see the bytes form.

As load on a stream, with heldRoots for a master list's own checks; see the bytes form.

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

Link copied to clipboard
actual fun merge(vararg loads: TrustAnchorLoad): TrustAnchorLoad

Joins several loads into one: the anchors of all of them, without repeats (two anchors with the same encoded bytes count once; the first is kept), in the order given.

expect fun merge(vararg loads: TrustAnchorLoad): TrustAnchorLoad

Joins several loads into one: the anchors of all of them, without repeats (two anchors with the same encoded bytes count once; the first is kept), in the order given.

actual fun merge(vararg loads: TrustAnchorLoad): TrustAnchorLoad

Joins several loads into one: the anchors of all of them, without repeats (two anchors with the same encoded bytes count once; the first is kept), in the order given.

actual fun merge(vararg loads: TrustAnchorLoad): TrustAnchorLoad

Joins several loads into one: the anchors of all of them, without repeats (two anchors with the same encoded bytes count once; the first is kept), in the order given.