lmssl reference

Complete command-line flag reference, host schema contexts and methods, X.509 and TLS types, standard lmcode_std_v3 REST and CLI interfaces, and exit codes for lmssl v0.2.1 (bundling OpenSSL 4.0.3).

Host and CLI flags

Flag or commandArgumentsDescription
--versionnonePrint the lmssl and embedded OpenSSL version string (lmssl 0.2.1 (OpenSSL 4.0.3 29 Sep 2026)) and exit 0.
--lmcode<file.dslb> [args...]Validate and execute a compiled LMScript bytecode part; repeatable for multi-part runs with per-part ssl.args().
--dry-run--lmcode <file.dslb>Validate bytecode loading and run in dry mode without key generation, file writes, or socket operations.
--json--lmcode <file.dslb>Compatibility flag accepted for _lmcode_ invocations (all _lmcode_ runs emit a terminal JSON SDK frame on stdout).
--lmcode-schema[--json]Print a human-readable schema summary, or exact embedded schema JSON bytes when --json is passed.
--lmcode-signaturesnonePrint all 360 canonical context, function, and method signatures (134 host + 226 standard library).
<openssl-cmd>[openssl-args...]Any other command (version, req, x509, ca, s_client, enc, dgst, pkcs12, cms, ocsp, ...) runs OpenSSL 4.0.3 directly.

Ssl, Key, Csr, and Cert methods

Type / contextMethod signatureDescription
context ssl: Sslssl.version() -> string | ssl.args() -> StrList | ssl.now() -> string | ssl.monotonic_us() -> intReturn the OpenSSL version string, per-part CLI arguments, current UTC timestamp string, or monotonic microseconds.
Ssl (encoding / random)ssl.hex(string) | ssl.unhex(string) | ssl.b64(string) | ssl.unb64(string) -> string | ssl.rand_bytes(int) | ssl.rand_hex(int) -> stringConvert between raw byte strings and lowercase hex or Base64, or generate cryptographically secure random bytes/hex.
Ssl (crypto)ssl.digest(string, string) -> string | ssl.hmac(string, string, string) -> string | ssl.pbkdf2(string, string, int, string, int) -> stringCompute lowercase hex message digest (alg, data), HMAC (alg, key, data), or PBKDF2 key (alg, pass, iter, salt_hex, len).
Ssl (AEAD)ssl.seal(string, string, string, string, string) -> string | ssl.open(string, string, string, string, string) -> stringEncrypt or decrypt with AES-128-GCM, AES-256-GCM, or ChaCha20-Poly1305 (cipher, key_hex, iv_hex, aad, plain_or_ct_hex).
Ssl (keys)ssl.gen_rsa(int) | ssl.gen_ec(string) | ssl.gen_ed25519() -> Key | ssl.load_key(string[, string]) | ssl.parse_key(string) -> KeyGenerate RSA (bits), EC (P-256, P-384, P-521), or Ed25519 keys, or load/parse a PEM private key (with optional passphrase).
Ssl (certs / CSRs)ssl.new_cert(Key, string) | ssl.cert_from_csr(Csr) | ssl.load_cert(string) | ssl.parse_cert(string) -> CertCreate an X.509 certificate template from a key and subject DN or CSR, or load/parse an existing PEM certificate.
Ssl (CSR / TLS ctx)ssl.new_csr(Key, string) | ssl.load_csr(string) -> Csr | ssl.client_ctx() -> TlsCtx | ssl.server_ctx(Cert, Key) -> TlsCtxCreate or load a PKCS#10 CSR, or create a client or server TLS context.
Keyk.type() | k.curve() | k.pem() | k.public_pem() | k.text() | k.fingerprint() -> string | k.bits() -> intInspect key algorithm, curve name, private/public PEM, human-readable OpenSSL dump, SHA-256 public key fingerprint, or bit size.
Keyk.save(string) | k.save_encrypted(string, string) -> void | k.sign(string, string) -> string | k.verify(string, string, string) -> boolSave private key PEM with 0600 permissions (plain or passphrase-encrypted), or sign/verify data with digest and hex signature.
Csrcsr.san(string) | csr.sign(Key, string) -> Csr | csr.verify() -> bool | csr.subject() | csr.pem() | csr.text() -> string | csr.save(string) -> voidAdd Subject Alternative Names, sign or verify the CSR, inspect subject/PEM/text, or save to disk.
Cert (builders)c.serial(int) | c.valid_days(int) | c.valid_between(string, string) | c.san(string) | c.ca(bool) | c.ext(string, string) -> CertConfigure serial number, validity window, comma-separated SANs (DNS:...,IP:...), CA basicConstraint, or arbitrary X.509v3 extensions.
Cert (signing)c.sign_self(Key, string) -> Cert | c.sign_with(Cert, Key, string) -> CertFinalize standard extensions (SKI, AKI, basicConstraints) and self-sign or sign with an issuer Cert and Key.
Cert (inspectors)c.subject() | c.issuer() | c.serial_hex() | c.not_before() | c.not_after() | c.san_text() | c.sig_alg() | c.key_type() | c.fingerprint(string) | c.pem() | c.text() -> stringInspect certificate DNs, serial, validity timestamps, SANs, signature/key algorithms, digest fingerprint, PEM, or full text dump.
Cert (predicates)c.is_ca() | c.self_signed() | c.expired() | c.matches_host(string) | c.verify_with(Cert) -> bool | c.save(string) -> voidCheck CA flag, self-signed status, expiration, hostname/SAN match, cryptographic signature by an issuer Cert, or write PEM to disk.

Net, Conn, Listener, TlsCtx, Tls, Fs, and Out methods

Type / contextMethod signatureDescription
context net: Netnet.resolve(string) -> StrList | net.connect(string, int) -> Conn | net.listen(int) -> Listener | net.timeout(int) -> voidResolve a hostname to IP strings, open a TCP connection, bind a local TCP listener (port 0 chooses an ephemeral port), or set socket timeout seconds.
Connconn.peer() | conn.local() -> string | conn.write(string) -> int | conn.read(int) | conn.read_until(string, int) -> string | conn.close() -> voidInspect remote/local address:port, read or write plain TCP bytes, read until delimiter up to max bytes, or close the connection.
Listenerl.port() -> int | l.accept() -> Conn | l.close() -> voidReturn the bound TCP port, accept an incoming TCP connection, or close the listener.
TlsCtxctx.min_version(string) | ctx.max_version(string) | ctx.alpn(string) | ctx.ciphers(string) | ctx.suites(string) | ctx.groups(string) -> TlsCtxConfigure TLS protocol bounds (TLS1.2, TLS1.3), comma-separated ALPN protocols, TLS 1.2 ciphers, TLS 1.3 cipher suites, or key-share groups.
TlsCtxctx.verify(bool) | ctx.ca_file(string) | ctx.add_ca(Cert) | ctx.system_roots() | ctx.chain(Cert) | ctx.client_cert(Cert, Key) | ctx.require_client(bool) | ctx.trace(bool) -> TlsCtxConfigure peer verification, trust anchors, intermediate chain certs, client mTLS certificate, mandatory client auth, or handshake message tracing.
TlsCtxctx.connect(Conn, string) -> Tls | ctx.accept(Conn) -> TlsPerform a client TLS handshake (with SNI and hostname verification) or server TLS handshake over an open Conn.
Tlstls.version() | tls.cipher() | tls.group() | tls.peer_sigalg() | tls.alpn() | tls.server_name() | tls.verify_result() | tls.trace() -> string | tls.verified() -> boolInspect negotiated TLS version, cipher, key-exchange group, signature scheme, ALPN, SNI, X.509 verification status, or recorded handshake trace.
Tlstls.peer() -> Cert | tls.chain_len() -> int | tls.chain_at(int) -> CertRetrieve the peer's leaf certificate or inspect certificates in the presented peer chain.
Tlstls.write(string) -> int | tls.read(int) | tls.read_until(string, int) | tls.read_all(int) -> string | tls.shutdown() -> voidWrite or read application data over the encrypted TLS stream or send a close_notify alert.
context fs: Fsfs.read(string) -> string | fs.write(string, string) | fs.write_private(string, string) | fs.mkdir(string) | fs.remove(string) -> void | fs.exists(string) -> boolRead and write files (write_private enforces mode 0600), check path existence, create directories, or remove paths.
context out: Out / functionsout.line(string) | out.text(string) | out.warn(string) | out.fail(string) | print(string) | assert_close(float, float, float) -> voidWrite diagnostic output to stderr, abort execution with APP_FAIL (exit code 4), print to stdout, or assert floating-point tolerance.

Standard lmcode_std_v3 REST and CLI interfaces

Interface or functionSignature / annotationDescription
RestGet .. RestOptions@"/path/:param" fn h(x: RestExchange) -> void implements RestGetBind an HTTP GET, POST, PUT, DELETE, PATCH, HEAD, or OPTIONS route handler.
RestHandler@"/path" fn h(x: RestExchange) -> void implements RestHandlerBind a method-agnostic HTTP route handler.
CliCommand@"cmd" fn h(x: RestExchange) -> void implements CliCommandBind a named CLI subcommand dispatched by rest_cli.
CliOption@"--flag" fn h(x: RestExchange) -> void implements CliOptionBind a CLI option flag (--flag=val or --flag val) evaluated before the command handler.
rest_configrest_config(key: string, value: string) -> voidConfigure server or CLI settings such as host, port, and session (ephemeral or global).
rest_routerest_route(method: string, path: string, handler: string) -> voidDynamically register an HTTP method and route pattern to a handler function name.
rest_serve / rest_stoprest_serve() -> void | rest_stop() -> voidStart or stop the embedded standard HTTP server loop.
rest_clirest_cli(args: StrList) -> stringDispatch CLI options, commands, or path requests in-process without opening a socket.
RestExchangex.method() | x.path() | x.body() | x.param(string) | x.query(string) | x.header(string) -> stringRead request method, path, body, :param segment, query parameter, or header.
RestExchangex.has_query(string) | x.has_header(string) -> boolCheck whether a query parameter or request header is present.
RestExchangex.status(int) | x.set_header(string, string) | x.send(string) | x.json(string) -> voidSet response status code and headers, and emit plain text or application/json bodies.
RestExchangex.get(string) -> string | x.set(string, string) -> void | x.increment(string) -> intRead, write, or atomically increment session state keys across global or ephemeral exchanges.

Exit codes

Exit codeCategoryMeaning
0SuccessAll _lmcode_ bytecode parts or introspection commands succeeded and all assertions passed.
2CLI / metadata errorMalformed host command-line invocation or missing required --lmcode argument.
3Load / host run errorBytecode load failure, schema SHA-256 mismatch, or runtime host error (RUN_HOST, such as TLS handshake failure or invalid cipher input).
4Application failureScript called out.fail(msg) or failed an assertion contract (code APP_FAIL).
0..255Native OpenSSL CLI modeWhen invoked with an OpenSSL subcommand (req, x509, s_client, ...), returns OpenSSL 4.0.3's native exit code.