Package biopb.tensor
Class FileTlsPinStore
java.lang.Object
biopb.tensor.FileTlsPinStore
- All Implemented Interfaces:
TlsPinStore
The pin store the Python SDK keeps, as a
TlsPinStore:
<state dir>/tls-known-hosts.json, a JSON object mapping
host:port to the pinned certificate as a PEM string.
A missing, unreadable or malformed file reads as an empty store, and an entry that is not a string is ignored. A write reads the file again, adds the entry, and replaces the file atomically (owner-only on POSIX), so a reader never sees half a file. It refuses to replace a file that exists but cannot be read as a JSON object, which would drop every other host's pin. Two processes pinning at the same moment can lose one of the pins (the later replace wins); that one is then pinned again on its next first use.
A write that fails (a read-only state directory, a full disk, a file it will not replace) is logged, and the pin is kept in memory by this store, so the connection goes on and the pin holds until the process ends.
-
Constructor Summary
ConstructorsConstructorDescriptionFileTlsPinStore(Path file) A store overfile; it is created on the firstput(java.lang.String, java.lang.String). -
Method Summary
-
Constructor Details
-
FileTlsPinStore
A store overfile; it is created on the firstput(java.lang.String, java.lang.String).
-
-
Method Details
-
get
Description copied from interface:TlsPinStoreThe PEM pinned forhostPort, or null if nothing is.- Specified by:
getin interfaceTlsPinStore
-
put
Description copied from interface:TlsPinStoreRecordpemas the pin forhostPort.- Specified by:
putin interfaceTlsPinStore
-