From c6d038b8a47f93006b7a2b5c06ec34e099f98433 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Mon, 27 Jan 2025 16:56:29 -0600 Subject: [PATCH] doc/userguide: document Lua base64 library Ticket: #7074 --- doc/userguide/lua/libs/base64.rst | 55 +++++++++++++++++++++++++++++++ doc/userguide/lua/libs/index.rst | 1 + 2 files changed, 56 insertions(+) create mode 100644 doc/userguide/lua/libs/base64.rst diff --git a/doc/userguide/lua/libs/base64.rst b/doc/userguide/lua/libs/base64.rst new file mode 100644 index 0000000000..4b8b5f81b3 --- /dev/null +++ b/doc/userguide/lua/libs/base64.rst @@ -0,0 +1,55 @@ +Base64 +------ + +Base64 functions are exposed to Lua scripts with the +``suricata.base64`` library. For example:: + + local base64 = require("suricata.base64") + +Functions +~~~~~~~~~ + +``encode(string)`` +^^^^^^^^^^^^^^^^^^ + +Encode a buffer with standard base64 encoding. This standard encoding +includes padding. + +``decode(string)`` +^^^^^^^^^^^^^^^^^^ + +Decode a base64 string that contains padding. + +``encode_nopad(string)`` +^^^^^^^^^^^^^^^^^^^^^^^^ + +Encode a buffer with standard base64 encoding but don't include any +padding. + +``decode_nopad(string)`` +^^^^^^^^^^^^^^^^^^^^^^^^ + +Decode a base64 string that contains no padding. + +``decode_padopt(string)`` +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Decode a base64 string that may or may not contain trailing padding. + +``decode_rfc2045(string)`` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Decode an RFC 2045 formatted base64 string. + +``decode_rfc4648(string)`` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Decode an RFC 4648 formatted base64 string. + +Implementation Details +~~~~~~~~~~~~~~~~~~~~~~ + +The base64 functions provided come from the Rust base64 library +documented at https://docs.rs/base64 and correspond to the +``STANDARD`` and ``STANDARD_NO_PAD`` base64 engines provided in that +library. diff --git a/doc/userguide/lua/libs/index.rst b/doc/userguide/lua/libs/index.rst index 9734a623f9..d9b4c393cc 100644 --- a/doc/userguide/lua/libs/index.rst +++ b/doc/userguide/lua/libs/index.rst @@ -8,5 +8,6 @@ environment without access to additional modules. .. toctree:: + base64 hashlib packetlib -- 2.47.2