.. _libervia-cli_xid_signature: ============================= xid signature: XID signatures ============================= Sign or verify data with a XID. sign ==== Sign a file or data with a XID private key. The data to sign can be provided in three ways: - a file path (default when the positional argument is not ``-``) - inline data with ``-d, --data`` - stdin when the positional argument is ``-`` (default) The XID to use is selected with ``-x, --xid``. If omitted, the current XID is used. The signature is output as a hexadecimal string. By default it is printed to stdout, but ``-o, --output`` can be used to write it to a file. examples -------- Sign a file:: $ li xid signature sign document.txt Sign data from stdin:: $ echo "hello" | li xid signature sign Sign inline data:: $ li xid signature sign -d "hello" Write the signature to a file:: $ li xid signature sign document.txt -o sig.hex check ===== Verify a signature against a XID public key. The data to verify can be provided the same way as for :ref:`sign`: - a file path (default) - inline data with ``-d, --data`` - stdin when the positional argument is ``-`` (default) The signature must be provided either with ``-s, --signature`` for an inline hex-encoded signature, or ``-f, --signature-file`` for a file containing the signature. These two options are mutually exclusive. examples -------- Verify a signature inline:: $ li xid signature check abcd1234@id.internal document.txt -s "a1b2c3…" Verify with a signature file:: $ li xid signature check abcd1234@id.internal document.txt -f sig.hex Verify data from stdin:: $ echo "hello" | li xid signature check abcd1234@id.internal -d - -s "a1b2c3…"