UKADOC Project
SAORI over DirectSSTP

Reference: SAORI/1.0 (external site)

This is an extension specification for sending SAORI/1.0 requests to the baseware using Direct SSTP, rather than the DLL request function, and calling functionality built into the baseware (built-in modules) as SAORI. [SSP 2.9.13]
From SHIORI's perspective, this is “SAORI that can be used without placing a DLL.” The baseware provides functions such as hashing, encryption, random number generation, and date and time calculations, which ghosts previously bundled with DLLs individually.
The first half of this page (from the overview of SAORI/1.0 through the sender-side procedure) describes a specification independent of the baseware; the second half (built-in modules) describes modules built into SSP.

Overview of SAORI/1.0

For the formal definition of SAORI/1.0, refer to the original source (external site). This page provides a brief summary of only the parts needed to read it.

Request

EXECUTE SAORI/1.0
Charset: UTF-8
Sender: 呼び出し元の名前
SecurityLevel: Local
Argument0: 1つ目の引数
Argument1: 2つ目の引数

Lines are separated by CR+LF, and the request ends with a blank line. Arguments are ordered by number, starting with Argument0. An argument with an empty value still counts as an argument at that position.
Charset specifies the request's character encoding, and the response is returned in the same encoding.
Use GET Version SAORI/1.0 to check whether a feature is available.

Response

SAORI/1.0 200 OK
Charset: UTF-8
Result: 結果
Value0: 複数の値を返すときの1つ目
200 OK
Success. The result is in Result. When returning multiple values, they are also included in Value0, Value1, and so on.
204 No Content
The request succeeded, but there is no value to return (the result is an empty string).
400 Bad Request
Incorrect invocation.
500 Internal Server Error
Processing failed.

SAORI over DirectSSTP

Sending a request

As with Direct SSTP, use WM_COPYDATA (dwData = 9801), put a SAORI/1.0 request in lpData instead of an SSTP request, and send it to your ghost's window (hwnd in FMO).
Window and WM_COPYDATA handling (sending with SendMessage functions, cbData, and so on) is the same as for Direct SSTP.

EXECUTE SAORI/1.0
Module: internal_crypto
Charset: UTF-8
Sender: YAYA
SecurityLevel: Local
HWnd: 1234
Argument0: Digest
Argument1: sha256
Argument2: abc
Module
Required. The name of the module to call. Specify the DLL name without .dll (e.g., internal_crypto, string). Case-insensitive.
If absent, returns 400 (ErrorDescription: invalid parameter); if the module is unknown, returns 400 (ErrorDescription: unknown module).
HWnd
The window that receives the response. If omitted, the window in wParam of WM_COPYDATA is used (the same rule as for SSTP over Direct SSTP).
Charset
The request's character encoding. The response uses the same encoding.
SecurityLevel
Always treated as Local over Direct SSTP (the header value is ignored).
Sender
The caller's name. The baseware does not use it.
Argument[n]
Arguments. The same as in SAORI/1.0.

Receiving a response

The response is sent to the HWnd (or wParam) window via WM_COPYDATA (dwData = 9801). It is a SAORI/1.0 response beginning with SAORI/.
The baseware sends the response while processing the request, so it arrives before the sender's SendMessage call returns.

Accepted transports

SAORI over DirectSSTP is accepted only over Direct SSTP.
Sending a SAORI/1.0 request over socket SSTP or SSTP over HTTP returns SAORI/1.0 400 Bad Request and ErrorDescription: direct sstp only (for SSTP over HTTP, this response is returned as the body of an HTTP 200 response).
SAORI requests are not recorded in the SSTP log.

Calling ghost

When sent to a ghost's window, that ghost is the caller.
If the calling ghost cannot be identified, such as when sent to the baseware's main window, the request is treated as having no ghost (unlike SSTP over Direct SSTP, a displayed ghost is not substituted). Operations that do not use a ghost work normally, while operations that depend on a ghost (asynchronous calls that deliver results via events, relative paths based on the ghost's folder, and so on) return 400 (ErrorDescription: ghost required).
The ReceiverGhostName / ReceiverGhostHWnd / ReceiverGhostUUID headers are ignored.

Preventing response mix-ups

The baseware treats incoming messages beginning with SAORI/ (or SSTP/) as responses, not requests.

Feature detection

To check whether a module is available, send GET Version SAORI/1.0 with Module. If available, it returns SAORI/1.0 200 OK (Result: SSP Internal in SSP).
Versions of SSP that do not support this extension (2.9.12 and earlier) read SAORI/1.0 requests as SSTP requests and return an SSTP error (SSTP/1.0 501 Not Implemented for GET Version, SSTP/1.0 400 Bad Request for EXECUTE).
The sender should consider the module unavailable if the response does not begin with SAORI/1.0 200 or if no response arrives.
A list of SSP's built-in modules and their functions can be obtained from internal_system. The options and algorithm names accepted by functions, including those added in newer versions of SSP, can be checked with Describe.

ErrorDescription

On failure, the response includes an ErrorDescription header giving the reason as a fixed English string. This header is not in the original SAORI/1.0 specification; it follows the header of the same name in SHIORI/3.0.
The following values are used by all modules. For others, see each module's documentation.

direct sstp only
400. Sent over a transport other than Direct SSTP.
unknown module
400. The module specified by Module does not exist.
unknown function
400. The function name (Argument0) does not exist in the module.
ghost required
400. An operation dependent on a ghost was requested when the calling ghost could not be identified.
invalid parameter
400. Module is missing, or an argument is missing or invalid.

Compatibility modules (compatible with DLL SAORI modules) may return 400 without ErrorDescription, as in the original implementations.

Values that cannot be written in headers

SAORI header values cannot contain newlines or leading or trailing whitespace (commas are allowed). For built-in modules, pass such data using a format such as --data-in=base64.

Asynchronous calls

Functions in built-in modules (those whose names begin with internal_) run asynchronously when given the --async=identifier option. Once the request is accepted, the response is returned immediately with status 204, and the result is later delivered to the calling ghost as an event.
This cannot be used when calling without a ghost (400 ghost required). If the identifier is empty, the response is 400 (invalid parameter).
Use --async for time-consuming operations (such as hashing large files or passwords, deriving keys, or generating RSA key pairs).
In SSP, up to roughly the number of CPUs (2–4) asynchronous calls can run at the same time. Any additional calls wait in order until an earlier one finishes.

Event that delivers the result

Event name
If the identifier starts with On (case-sensitive), that name is used on success, and “identifier + Failure” on failure. Avoid using the name of an existing event (such as OnBoot) as the identifier, as the result will be delivered as that event.
Otherwise, OnInternalSaoriComplete is used on success, and OnInternalSaoriFailure on failure.
Reference on success
Reference0 = identifier, Reference1 = result (the Result of a synchronous call), Reference2 = module name, Reference3 = function name, Reference4 onward = Value0 onward.
Reference on failure
Reference0 = identifier, Reference1 = reason for failure (the same string as ErrorDescription in a synchronous call), Reference2 = module name, Reference3 = function name.

Incorrect numbers of arguments or option names result in a 400 response upon acceptance. Errors in argument contents (such as unreadable hexadecimal) are delivered in the failure event.

Conditions and order of result delivery

  • If the calling ghost has not exited, the result is always delivered. It is delivered even while the ghost is time-critical or in passive mode or guidance mode (it is delivered as long as SHIORI remains loaded, even if it is stored in the cache). [SSP 2.9.27] Before this version, results might not be delivered if processing finished while in these states.
  • If SHIORI is processing another request, delivery waits until it finishes.
  • If the calling ghost exits before the result is delivered (including when SHIORI is reloaded), the result is not delivered.
  • Results from multiple asynchronous calls may not arrive in the order the calls were made (they arrive in order of completion, and calls that wait because the number of concurrent calls has been exceeded start in the order that slots become available). If order matters, match results by identifier, or make the next call after the previous result arrives.

Sender procedure

A sender such as SHIORI uses SAORI over DirectSSTP as follows.

  1. Obtain the window (hwnd) of your own ghost using FMO or a similar method.
  2. Prepare a window to receive the response.
  3. Construct a SAORI/1.0 request and add Module and HWnd (the window to receive the response).
  4. Send WM_COPYDATA (dwData = 9801) to the ghost's window using a SendMessage-family function.
  5. Read the data beginning with SAORI/ that arrives at the response-receiving window in a WM_COPYDATA message (dwData = 9801) as the response.

First check whether it is available using GET Version.

Example

In YAYA and Satori, SHIORI itself performs the procedure above. Use the same syntax as for DLL SAORI, with only the module name changed to a name beginning with internal_. For how to handle cases where it is unavailable (such as older SSP versions), see the documentation for each SHIORI.

YAYA(FUNCTIONEX)
// 同期
_hash = FUNCTIONEX('internal_crypto', 'Digest', 'sha256', 'abc')

// 非同期:結果は OnHashDone に届く(reference[0]=識別子、reference[1]=結果)
FUNCTIONEX('internal_crypto', 'HashPassword', 'secret', '--async=OnHashDone')
OnHashDone
{
  _phc = reference[1]
}
Satori(登録は不要で、モジュール名をそのまま()で呼ぶ)
*OnBoot
 (internal_crypto、Digest、sha256、abc)
 (internal_crypto、HashPassword、secret、--async=OnHashDone)

*OnHashDone
 (R1)

The result is handled as Result, and additional values as Value0 onward, just as with DLL SAORI. Calls with --async return an empty value.

Common rules for built-in modules

These are the rules shared by modules built into SSP whose names start with internal_. (Their names start with internal_ to avoid conflicts with SAORI DLLs with the same name.)
These modules can only be called from Direct SSTP. They cannot be loaded as DLLs.

Functions and arguments

Argument0 is the function name (case-insensitive), and Argument1 onward are its arguments. An unknown function name returns 400 (unknown function).
Each function takes a fixed number of positional arguments, followed by options (--name=value).

  • A value in a positional argument's position is treated as data, not as an option, even if it starts with --.
  • Options can only be written after positional arguments. When writing an option while skipping an optional positional argument, include an empty argument.
  • Option names are case-insensitive. If the same name is written twice, the later one takes effect.
  • --name without an = is equivalent to --name= with an empty value. Options with empty values can also be written. For example, --aad= represents "empty additional authentication data." However, if an option that requires a value to be meaningful (such as --async= or --iv=) is empty, the function fails (usually with 400 invalid parameter).
  • Arguments and options that take numbers require decimal integers, which may have a sign (+ or -). Spaces, hexadecimal numbers, and decimals are not allowed. If a value cannot be read as a number, the result is 400 (invalid parameter); if it does not fit in a signed 64-bit integer, the result is 400 (out of range). The valid range is determined by each function.
  • A value after the positional arguments that does not start with --, or an option not accepted by the function, results in 400 (invalid parameter). This can happen when passing an option added in a newer SSP to an older SSP, so you can check whether an option is supported with internal_system's Describe.
  • [SSP 2.9.25] Functions with no fixed number of positional arguments (MediaInfo in internal_file and, [SSP 2.9.27] ImageInfo) read everything from the first value starting with -- in the second or later position as options.
  • All functions accept --async=identifier.
Argument0: Digest
Argument1: sha256
Argument2: SGVsbG8=
Argument3: --data-in=base64
Argument4: --out=base64

Byte input formats

Hashes and similar operations work with byte sequences, but SAORI can pass only strings. Each argument that takes a byte sequence has a name (such as data, key, password, salt, ciphertext, signature, a, and b; see each function's description), and you can change how the argument is read with --name-in=format. For example: --key-in=hex, --data-in=base64.
Byte sequences passed as options (--aad=, --iv=, --info=) work the same way; you can change how they are read with options such as --aad-in=hex.

text
Converts the string to bytes using the character encoding specified by --charset= (default: UTF-8). This is not the request's Charset (so the result is the same regardless of the sender's character encoding, as with Web API signatures). If a character cannot be represented in that encoding, the result is 400 (invalid encoding).
hex
Hexadecimal. Uppercase and lowercase are both accepted. An odd number of digits or a non-hexadecimal character results in 400 (invalid encoding).
base64 / base64url
Padding (=) is optional. Both formats accept characters from base64 and base64url (+ / - _). Any other character or invalid padding results in 400 (invalid encoding).
base32
RFC 4648. Uppercase and lowercase are both accepted, and padding is optional. Invalid characters result in 400 (invalid encoding).
url
Percent-decodes the value. + is not converted to a space. If the two characters after % are not hexadecimal digits, the result is 400 (invalid encoding).
bech32
[SSP 2.9.14] BIP-173 bech32 (such as nostr's npub1... / nsec1...; bech32m cannot be read). Converts the data part to a byte sequence. The part before 1 (the HRP, such as npub) is ignored, so check the beginning of the string in your script if you need to verify its type. All-uppercase and all-lowercase strings are accepted. Mixed case, an invalid checksum, or an invalid character results in 400 (invalid encoding). There is no length limit (BIP-173's limit of 90 characters does not apply).
file
Treats the value as a file path and reads the file contents. This can only be used for data in Digest / HMAC in internal_crypto (using it with another function or an argument other than data results in 400 invalid parameter).
Paths follow the rules in File paths. If the file does not exist, the result is 400 (file not found); if reading fails partway through, the result is 500 (file read failed).

The default format is defined for each argument (see each function's description). Decoded data is limited to 8 MB per argument (too large), but since a Direct SSTP request itself is limited to 1 MB, the actual limit is lower. file is read in chunks, so it has no size limit.

Byte output formats

Functions that return byte sequences can change how the result is written with --out=format. The default format is defined for each function. The default output format matches the default input format for the same name, so you can pass the output directly to another function.

hex
Hexadecimal (lowercase).
HEX
Hexadecimal (uppercase). Format names are case-insensitive, but HEX in --out= is an exception: the output is uppercase only when written as HEX (Hex produces lowercase hexadecimal). For input --name-in=, HEX is read as the same format as hex.
base64
With padding.
base64url
Without padding.
base32
RFC 4648. With padding.
url
Converts all characters other than RFC 3986 unreserved characters (A-Z a-z 0-9 - . _ ~) to %XX (uppercase).
bech32
[SSP 2.9.14] BIP-173 bech32 (lowercase). Specify the HRP (such as npub, 1–83 characters) with --hrp=. Only Convert in internal_data accepts --hrp=; using --out=bech32 with another function results in 400 (invalid parameter).
text
Returns the result as a string using the encoding specified by --charset= (default: UTF-8). If the bytes cannot be converted back correctly using that encoding, or contain NUL or a newline (which cannot be written in a SAORI header), the result is 500 (not text).
Responses are returned using the request's Charset encoding, so characters that cannot be represented in that encoding become ?. To ensure any character can be received, send the request with Charset: UTF-8.

For --charset=, specify a character encoding name (such as UTF-8, Shift_JIS, or EUC-JP). An unknown name, UTF-16, or UTF-32 results in 400 (invalid parameter).

File paths

These rules apply to arguments that specify files (--data-in=file and the functions in internal_file).

  • Relative paths are resolved from the ghost folder (ghost/master). A relative path passed in a call with no ghost results in 400 (ghost required).
  • Both / and \ can be used as separators.
  • If a directory is passed to an argument that expects a file, it is treated as if the file does not exist and results in 400 (file not found).
  • [SSP 2.9.33] If a file is passed to an argument that expects a directory (the source directory for CompressArchive), the result is 400 (invalid parameter).
  • There are no restrictions on files that can be read. Operations that only read files (hashing with --data-in=file, MediaInfo / ImageInfo / IsMediaLoadable / IsImageLoadable, the archive for ExtractArchive, and the source for CompressArchive) can read files outside SSP-managed folders when given an absolute path. Only write destinations (the destination for CompressArchive and the extraction destination for ExtractArchive) are restricted to SSP-managed folders. Since file existence can be determined by whether the result is file not found, do not pass user input or similar directly as a path.

Responses and failure reasons

On success, the result is returned in Result with status 200. If the result is an empty string, the status is 204. Functions that return a boolean return 1 (true) or 0 (false) with status 200. A result such as "no match" is not a failure.
In addition to the common cases, ErrorDescription can contain the following:

unsupported algorithm
400. Unknown algorithm name.
invalid encoding
400. The value cannot be read in the format specified by --name-in=, or compressed data is corrupted.
invalid key
400. The key length does not match the algorithm, the key cannot be read as a public-key cryptography key, or the key type does not match the method.
out of range
400. A number or date/time is outside the supported range.
too large
400. The data is too large.
file not found
400. The file specified by --data-in=file does not exist.
not text
500. The value cannot be converted back to a string with --out=text.
file read failed
500. Reading the file failed partway through.
authentication failed
500. Decryption failed (for example, because the ciphertext was tampered with or the key is incorrect), or a JWT could not be verified.
expired / not yet valid
500. The JWT has expired (exp) / the current time is before its valid-from time (nbf).
internal error
500. An unexpected failure occurred inside the baseware.

internal_data

Data format conversion, compression, and decompression.

Convert

Converts data to another format (base64 ⇔ hexadecimal ⇔ percent-encoding ⇔ string, etc.). Specify the input with --data-in= and the output with --out=.

Argument1
data (default format is text)
Options
--data-in= / --out= (default is text) / --charset= / --hrp= ([SSP 2.9.14] hrp for --out=bech32)

Example

Argument0: Convert
Argument1: 48656c6c6f
Argument2: --data-in=hex
Argument3: --out=base64

→ Result: SGVsbG8=
Argument0: Convert
Argument1: 7e7e9c42a91bfef19fa929e5fda1b72e0ebc1a4c1141673e2794234d86addf4e
Argument2: --data-in=hex
Argument3: --out=bech32
Argument4: --hrp=npub

→ Result: npub10elfcs4fr0l0r8af98jlmgdh9c8tcxjvz9qkw038js35mp4dma8qzvjptg
  • SSP2.9.13
Compress

Compresses data.

Argument1
algorithm: gzip / zlib / deflate (raw deflate without a header)
Argument2
data (default format is text)
Options
--data-in= / --level= (0–9. If omitted or set to -1, zlib's default is used. Values outside the range return 400 out of range) / --out= (default is base64) / --charset=
  • SSP2.9.13
Decompress

Decompresses compressed data. gzip can also read concatenated members.
If the data is corrupted, truncated, or followed by extraneous data, 400 (invalid encoding) is returned. The decompressed size is also limited to 8MB (exceeding this returns 400 too large).

Argument1
algorithm: gzip / zlib / deflate / brotli / zstd (brotli and zstd support decompression only)
Argument2
data (default format is base64)
Options
--data-in= / --out= (default is text) / --charset=

Example

Argument0: Decompress
Argument1: gzip
Argument2: H4sIAAAAAAAACvNIzcnJBwCCidH3BQAAAA==

→ Result: Hello
  • SSP2.9.13

internal_crypto

Hashing, MAC, symmetric-key encryption, key derivation, password hashing, data protection (DPAPI), one-time passwords (TOTP), public-key signatures and key agreement.
The algorithm names for Digest / HMAC (and --digest= for DeriveKey / TOTP) are as follows. Hyphens, underscores, and letter case are ignored (SHA-256, sha_256, and sha256 are equivalent). Other names return 400 (unsupported algorithm).
md5 sha1 sha224 sha256 sha384 sha512 sha512-256 sha3-224 sha3-256 sha3-384 sha3-512 blake2b512 blake2s256
Digest also accepts the non-cryptographic checksums crc32 / adler32 ([SSP 2.9.27]).
Available algorithm names and options can be checked with internal_system's Describe.

Digest

Calculates a hash value.

Argument1
Algorithm name (hash functions in the list, as well as crc32 / adler32, checksums that are not for cryptographic use [SSP 2.9.27])
Argument2
data (the default format is text; file can also be used)
Options
--data-in= / --out= (default is hex) / --charset=

Example

Argument0: Digest
Argument1: sha256
Argument2: abc

→ Result: ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad

Strings are hashed by default as UTF-8 byte sequences. To hash a Shift_JIS byte sequence, specify --charset=Shift_JIS.

[SSP 2.9.27] crc32 (CRC-32, same as zlib, gzip, and PNG) and adler32 (Adler-32, same as zlib) are checksums used to verify that a file is not corrupted; they are not cryptographically secure (do not use them to detect tampering; use SHA-256 or similar for that). The result is 4 bytes (most significant byte first), and with the default hex for --out=, it is 8 characters (crc32 of 123456789 is cbf43926, and adler32 is 091e01de). file can also be used. These algorithms cannot be used with HMAC, DeriveKey, or TOTP (400 unsupported algorithm).

  • SSP2.9.13
HMAC

Compute an HMAC.

Argument1
algorithm name
Argument2
key (default format is text)
Argument3
data (default format is text; file can also be used)
Options
--key-in= / --data-in= / --out= (default is hex) / --charset=
  • SSP2.9.13
Compare

Compare two byte sequences in the same amount of time regardless of their contents. Returns 1 if they are equal and 0 if they differ (also returns 0 if their lengths differ).
Use this when you do not want the contents to be inferred from the comparison time, such as when checking a Webhook signature. When comparing hexadecimal signatures, use --a-in=hex --b-in=hex to ignore differences in letter case.

Argument1
a (default format is text)
Argument2
b (default format is text)
Options
--a-in= / --b-in= / --charset=
  • SSP2.9.13
Symmetric-key encryption (Encrypt / Decrypt)

The supported algorithms are as follows (hyphens and underscores in names, and letter case, are ignored). Other algorithms return 400 (unsupported algorithm).

aes-256-gcm (recommended) / aes-128-gcm / chacha20-poly1305
Authenticated encryption. Tampered ciphertext cannot be decrypted. The ciphertext format is “nonce (12 bytes) + ciphertext + authentication tag (16 bytes).”
aes-256-cbc / aes-128-cbc
PKCS#7 padding. The ciphertext format is “IV (16 bytes) + ciphertext.” This cannot detect tampering, so use it only when communicating with other systems.
aes-256-ctr
The ciphertext format is “IV (16 bytes) + ciphertext.” This cannot detect tampering.
chacha20
[SSP 2.9.14] Unauthenticated ChaCha20 (RFC 8439; 12-byte nonce, block counter starts at 0). The ciphertext format is “nonce (12 bytes) + ciphertext.” This cannot detect tampering, so use it only when communicating with other systems that use a separate MAC, such as nostr's NIP-44.

The key length must exactly match the algorithm's key length (32 bytes for AES-256 and ChaCha20, 16 bytes for AES-128); otherwise, 400 (invalid key) is returned. To derive a key from a password, use DeriveKey.
Generate the nonce / IV randomly for each encryption and prepend it to the ciphertext. --iv= (to specify a nonce / IV) and --pack=none (not to prepend it) are intended only for cases where another system passes the nonce separately. Reusing the same nonce / IV twice with the same key breaks GCM, ChaCha20-Poly1305, and CTR as encryption (plaintext is exposed and tampering becomes possible). Do not use a fixed value for --iv= or reuse it.

All invalid options return 400 (invalid parameter).

  • --aad= was specified for an unauthenticated algorithm (CBC, CTR, or chacha20).
  • The length of --iv= is not exactly the length of the algorithm's nonce / IV (“12 bytes” or “16 bytes” above).
  • A value other than none was specified for --pack=.
Encrypt

Encrypt using symmetric-key cryptography.

Argument1
algorithm name (see symmetric-key encryption)
Argument2
key (default format is text)
Argument3
data (default format is text)
Options
--key-in= / --data-in= / --aad= (additional authenticated data; authenticated encryption only. --aad-in=, default format is text) / --iv= (--iv-in=, default format is hex) / --pack=none / --out= (default is base64) / --charset=

Example

Argument0: Encrypt
Argument1: aes-256-gcm
Argument2: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
Argument3: secret message
Argument4: --key-in=hex

→ Result: (毎回違うbase64)
  • SSP2.9.13
Decrypt

Decrypt ciphertext produced by Encrypt.
If decryption fails, returns 500 (authentication failed). With authenticated encryption, this happens if the ciphertext, authentication tag, or --aad= differs. With CBC, this happens if the padding is invalid. This also happens if the ciphertext is shorter than the initial nonce / IV (or, for authenticated encryption, shorter than that plus the trailing authentication tag). Unauthenticated CTR and chacha20 return some value even with an incorrect key.

Argument1
algorithm name
Argument2
key (default format is text)
Argument3
ciphertext (default format is base64)
Options
--key-in= / --ciphertext-in= / --aad= / --aad-in= / --iv= / --iv-in= / --pack=none / --out= (default is text) / --charset=

When using --pack=none, --iv= is required. If --pack=none is not used (the nonce / IV is at the start of the ciphertext), specifying --iv= returns 400 (invalid parameter).

  • SSP2.9.13
DeriveKey

Derives a byte sequence for use as an encryption key from a password or similar input. Specify parameters for each method as options; specifying an option that is not used by the method returns 400 (invalid parameter).
Since this operation uses time and memory, --async is recommended.

Argument1
Method: pbkdf2 / hkdf / hkdf-extract / hkdf-expand / scrypt / argon2id
Argument2
password (default format is text)
Argument3
salt (default format is text)
Argument4
Length (bytes; 1–1024)
Options
--password-in= / --salt-in= / method-specific options below / --out= (default is hex) / --charset=
pbkdf2
--digest= (default is sha256) / --iterations= (default is 600000; 1–10000000)
hkdf
--digest= (default is sha256) / --info= (--info-in=, default format is text). The password is the input key (IKM) and cannot be empty (an empty value returns 400 invalid parameter). The salt may be empty.
hkdf-extract
[SSP 2.9.14] HKDF extract only (RFC 5869 §2.2). --digest= (default is sha256). The password is the input key (IKM; it cannot be empty, and an empty value returns 400 invalid parameter); the salt is used as is. The result is the PRK, and its length must be exactly the hash length (32 for sha256), or 400 (out of range) is returned.
hkdf-expand
[SSP 2.9.14] HKDF expand only (RFC 5869 §2.3). --digest= (default is sha256) / --info=. The password is the PRK (it cannot be empty; an empty value returns 400 invalid parameter). The salt must be empty (a non-empty value returns 400 invalid parameter). The length can be up to 255 times the hash length.
scrypt
--n= (default is 8192; must be a power of 2 and at least 2, or 400 invalid parameter is returned) / --r= (default is 8) / --p= (default is 10; 1–16). N×r×128 bytes must not exceed 12 MiB.
argon2id
--iterations= (default is 3; 1–1000) / --memory= (KiB; default is 12288; lanes×8–12288) / --lanes= (default is 1; 1–16). The salt must be at least 8 bytes (a shorter value returns 400 invalid parameter), and the length must be at least 4 (a shorter value returns 400 out of range). The version is 1.3 (0x13). Secret keys (secret) and associated data cannot be used.

Values outside the allowed ranges return 400 (out of range). The default parameters use a combination of OWASP-recommended values that stays within the memory limit (12 MiB).

Example

Argument0: DeriveKey
Argument1: pbkdf2
Argument2: password
Argument3: salt
Argument4: 20
Argument5: --digest=sha1
Argument6: --iterations=4096

→ Result: 4b007901b765489abead49d926f721d065a429c1
  • SSP2.9.13
HashPassword

Hashes a password for storage and returns it as a PHC string (a single-line string combining the method, parameters, salt, and hash). The salt is a 16-byte random value generated each time, the hash is 32 bytes, and the parameters are fixed as shown in the table below (using an OWASP-recommended configuration that fits within the 12 MiB memory limit).
Verify the stored string with VerifyPassword. --async is recommended.

Argument1
password (the default format is text)
Options
--method= (see the table below; default is argon2id) / --password-in= / --charset=
argon2id
$argon2id$v=19$m=12288,t=3,p=1$ソルト$ハッシュ
scrypt
$scrypt$ln=13,r=8,p=10$ソルト$ハッシュ (ln is the logarithm of N to base 2)
pbkdf2-sha256
$pbkdf2-sha256$i=600000,l=32$ソルト$ハッシュ
bcrypt
[SSP 2.9.23] $2b$12$ + 22 salt characters + 31 hash characters. Only the first 72 bytes of the password are used.
sha512-crypt
[SSP 2.9.23] $6$rounds=656000$ソルト$ハッシュ (the salt is 16 characters)
sha256-crypt
[SSP 2.9.23] $5$rounds=535000$ソルト$ハッシュ (the salt is 16 characters)
md5-crypt
[SSP 2.9.23] $1$ソルト$ハッシュ (the salt is 8 characters)
apr1
[SSP 2.9.23] $apr1$ソルト$ハッシュ (the salt is 8 characters; the Apache htpasswd format)
bsdi-crypt
[SSP 2.9.23] _ + 4 iteration-count characters + 4 salt characters + 11 hash characters (BSDi's extended DES; the iteration count is 5001)
des-crypt
[SSP 2.9.23] 2 salt characters + 11 hash characters (traditional crypt(3) DES). Only the first 8 characters of the password are used.

The salt and hash are base64-encoded (without padding).
[SSP 2.9.23] bcrypt and the methods below use the crypt(3) format, intended for interoperability with other systems (/etc/shadow, htpasswd, PHP's password_hash, etc.). Hyphens and underscores, and letter case, in the --method= name are ignored. The salt and hash use the characters allowed by each format (./0-9A-Za-z), and the parameters are fixed as shown in the table above. md5-crypt, apr1, bsdi-crypt, and des-crypt are weak methods today and should only be used for interoperability. The crypt(3) format does not allow NUL (0x00) in passwords; if present, the result is 400 (invalid parameter). Passwords longer than 1024 bytes result in 400 (out of range).

  • SSP2.9.13
VerifyPassword

Checks whether a password matches a PHC string, returning 1 if it does and 0 otherwise. Parameters are read from the PHC string. --async is recommended.
In addition to output from HashPassword, strings produced by other implementations can also be read if they have the same format ($argon2id$ (with no v= or with v=16) / $scrypt$ / $pbkdf2-sha1$ / $pbkdf2-sha256$ / $pbkdf2-sha512$). However, parameters that exceed the memory limit (12MiB), such as argon2-cffi's default of 64MiB, cannot be verified and return 400 (out of range).
[SSP 2.9.23] crypt(3) formats can also be read ($2a$ / $2b$ / $2y$ (bcrypt; all three are treated identically) / $6$ / $5$ (with no rounds= or with values below 1000 rounded up to 1000) / $1$ / $apr1$ / 20 characters beginning with _ (BSDi extended DES) / 13 characters (traditional DES)). The bcrypt cost is limited to 16, and rounds= for SHA-crypt is limited to 10000000; exceeding these limits returns 400 (out of range). $2x$ and $2$ are not supported.
Other algorithms return 400 (unsupported algorithm), malformed formats return 400 (invalid parameter), and parameters outside the range of DeriveKey return 400 (out of range; for scrypt, ln= must be between 1 and 62). If the pbkdf2 l= does not match the hash length, it is also treated as a malformed format and returns 400 (invalid parameter).

Argument1
password (default format is text)
Argument2
PHC string (or [SSP 2.9.23] a crypt(3)-format string)
Options
--password-in= / --charset=
  • SSP2.9.13
Protect

Wrap data using the OS data protection feature (Windows DPAPI). The wrapped data can be unwrapped with Unprotect only by the same user on the same PC (or by any user on the same PC if --scope=machine is specified).
This is intended to prevent tokens and similar data stored in save data from being read if copied to another PC or another user's account; it does not isolate ghosts from each other (other ghosts or programs running as the same user can unwrap the data).

Argument1
data (default format is text)
Options
--data-in= / --scope=user (default) / --scope=machine (any other value results in 400 invalid parameter) / --out= (default is base64) / --charset=

If save data is moved to another PC (for example, by sharing SSP save data, synchronizing it through cloud storage, or copying it manually), or if the Windows user account is recreated, the data can no longer be unwrapped. Scripts should handle Unprotect failures by, for example, asking the user to log in again.

  • SSP2.9.13
Unprotect

Unwrap data wrapped with Protect. If it cannot be unwrapped, the result is 500 (authentication failed).

Argument1
data (default format is base64)
Options
--data-in= / --out= (default is text) / --charset=
  • SSP2.9.13
TOTP

Generate a time-based one-time password (RFC 6238; the digits produced by a two-factor authentication app). If the result has fewer digits than specified, it is padded with leading zeros.

Argument1
key (default format is base32; the secret key string to register with the authentication app)
Options
--key-in= / --digits= (default is 6; 6–10) / --period= (seconds; default is 30; 1–86400) (values outside the range result in 400 out of range) / --digest= (default is sha1; md5 cannot be used and results in 400 unsupported algorithm) / --time= (date and time. Use the same format as the date and time arguments in internal_time; values without a zone use the OS time zone. Defaults to the current time) / --charset=

Example

Argument0: TOTP
Argument1: GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ
Argument2: --time=59
Argument3: --digits=8

→ Result: 94287082
  • SSP2.9.13
Public-key cryptography (GenerateKeyPair / Sign / Verify / KeyAgreement)

The supported signature algorithms are as follows (hyphens and underscores in names, and letter case, are ignored). Other algorithms return 400 (unsupported algorithm). ed25519 through ps512 produce signatures equivalent to the JWT (JWS) alg values EdDSA / ES256 / ES384 / ES512 / RS256 / RS384 / RS512 / PS256 / PS384 / PS512, respectively. [SSP 2.9.27] es384 es512 rs384 rs512 ps384 ps512 were added.

ed25519
Ed25519 (RFC 8032). Signatures are 64 bytes.
es256 / es384 / es512
ECDSA (es256 is P-256 + SHA-256, es384 is P-384 + SHA-384, es512 is P-521 + SHA-512). Signatures are r‖s, 64 / 96 / 132 bytes (the same format as JWS, not DER; r and s for P-521 are 66 bytes each).
rs256 / rs384 / rs512
RSA (RSASSA-PKCS1-v1_5) + SHA-256 / SHA-384 / SHA-512.
ps256 / ps384 / ps512
RSA (RSASSA-PSS) + SHA-256 / SHA-384 / SHA-512. MGF1 uses the same hash, and the salt length is the hash length (32 / 48 / 64 bytes; the same as JWA's PS256 / PS384 / PS512).
bip340
secp256k1 Schnorr signature (BIP-340; the same as nostr event signatures). Signatures are 64 bytes. The message is signed as-is without hashing (any length is allowed; for nostr, pass the event ID (32 bytes) using --data-in=hex). Keys are passed differently from the other algorithms (see below).

Pass keys as single-line DER base64 or PEM. GenerateKeyPair outputs the former (private key is PKCS#8, public key is SubjectPublicKeyInfo).
PEM includes newlines and cannot be written in a SAORI header, so pass it with newlines replaced by spaces (or with newlines removed to make it a single line). If it starts with -----BEGIN, it is read as PEM, with the content between -----BEGIN ...----- and -----END read as base64.
Private keys can be read in PKCS#8 (PRIVATE KEY), as well as PKCS#1 (RSA PRIVATE KEY) for RSA and SEC1 (EC PRIVATE KEY) for ECDSA. Password-encrypted private keys cannot be read. Public keys use SubjectPublicKeyInfo (PUBLIC KEY).
RSA keys must be 2048–4096 bits, and ECDSA keys must use the curve for the algorithm (P-256 for es256, P-384 for es384, P-521 for es512). Unreadable keys, or keys whose type or size does not match the algorithm, return 400 (invalid key).

bip340 uses raw values, not DER / PEM. The private key is 32 bytes; the public key is only the 32-byte x-coordinate (BIP-340 format, the same as a nostr public key). The default format is hex. The input format can be changed with --key-in= (with --key-in=bech32, nsec1... / npub1... can be passed as-is).
Keys with an incorrect length, or private keys equal to 0 or greater than or equal to the curve order, return 400 (invalid key). --key-in= can only be used with bip340 (using it with another algorithm returns 400 invalid parameter).

The keys for KeyAgreement (secp256k1 x25519 p256) are also raw values (see the KeyAgreement description for their format).

GenerateKeyPair

Creates a public-key cryptography key pair. Value0 contains the private key (PKCS#8), and Value1 contains the public key (SubjectPublicKeyInfo), both base64-encoded DER. Result is the same as Value0.
RSA key generation can take several seconds, so --async is recommended (for asynchronous calls, the private key is placed in Reference4 and the public key in Reference5).
If needed, wrap the private key with Protect before saving it.

Argument1
Algorithm: ed25519 / es256 (P-256) / es384 (P-384. [SSP 2.9.27]) / es512 (P-521. [SSP 2.9.27]) / rsa-2048 / rsa-3072 / rsa-4096 (RSA keys can be used with any of rs256 through ps512) / bip340 (secp256k1) / x25519 ([SSP 2.9.27]) / p256 ([SSP 2.9.27])

Only for bip340, x25519, and p256, the values are raw rather than DER, and both are in lowercase hexadecimal.

bip340
Value0 contains the private key (32 bytes), and Value1 contains the public key with only the x-coordinate (32 bytes). To convert them to nostr nsec / npub, use --out=bech32 with Convert. This key can also be used as-is with secp256k1 in KeyAgreement.
x25519
Value0 contains the private key (32 bytes), and Value1 contains the public key (32 bytes). It can be used as-is with x25519 in KeyAgreement.
p256
Value0 contains the private key (32 bytes), and Value1 contains the uncompressed public key (65 bytes; begins with 04). It can be used as-is with p256 in KeyAgreement. Its format differs from the signing key for es256 (DER).
  • SSP2.9.14 (es384 es512 x25519 p256 are supported in SSP 2.9.27)
Sign

Sign data with a private key.

Argument1
method (see public-key cryptography)
Argument2
private key
Argument3
data (default format is text)
Options
--data-in= / --out= (default is base64url; bip340 uses hex) / --charset= / --key-in= (bip340 only; default is hex) / --aux= (bip340 only; 32 bytes of auxiliary random data for BIP-340. --aux-in=, default format is hex. Random data is generated each time if omitted. Use this only when comparing against test vectors)

Example

Argument0: Sign
Argument1: ed25519
Argument2: MC4CAQAwBQYDK2VwBCIEIJ1hsZ3v/VpguoRK9JLsLMREScVpezJpGXA7rAMcrn9g
Argument3: eyJhbGciOiJFZERTQSJ9.RXhhbXBsZSBvZiBFZDI1NTE5IHNpZ25pbmc

→ Result: hgyY0il_MGCjP0JzlnLWG1PPOt7-09PGcvMg3AIbQR6dWbhijcNR4ki4iylGjg5BhVsPt9g7sVvpAr_MuM0KAg
Argument0: Sign
Argument1: bip340
Argument2: b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da56a784d9045190cfef
Argument3: 243f6a8885a308d313198a2e03707344a4093822299f31d0082efa98ec4e6c89
Argument4: --data-in=hex
Argument5: --aux=0000000000000000000000000000000000000000000000000000000000000001

→ Result: 6896bd60eeae296db48a229ff71dfe071bde413e6d43f917dc8dcf8c78de33418906d11ac976abccb20b091292bff4ea897efcb639ea871cfa95f6de339e4b0a

(BIP-340 test vector 1)

Ed25519 and RSA (rs256 / rs384 / rs512) produce the same signature each time when given the same key and data. es256 / es384 / es512, ps256 / ps384 / ps512, and bip340 produce a different signature each time (all can be verified with Verify).

  • SSP2.9.14
Verify

Verify a signature with a public key. Returns 1 if valid, or 0 if invalid (also returns 0 if the signature length is wrong). A private key may be passed instead of a public key (bip340 excluded).
For bip340, a 32-byte public key that is not a point on the curve also returns 0, as specified by BIP-340 (a different length results in 400 invalid key).

Argument1
method (see public-key cryptography)
Argument2
public key
Argument3
data (default format is text)
Argument4
signature (default format is base64url; bip340 uses hex)
Options
--data-in= / --signature-in= / --charset= / --key-in= (bip340 only; default is hex)
  • SSP2.9.14
KeyAgreement

Derive a shared secret from your private key and the other party's public key, so that both parties obtain the same value (ECDH). The result is 32 bytes and is not hashed (secp256k1 is the point's x-coordinate as-is, as in nostr's NIP-44; x25519 is the RFC 7748 result as-is; p256 is the point's x-coordinate as-is).
Do not use the result directly as an encryption key. Pass it through hkdf (or hkdf-extract) in DeriveKey before using it.

Argument1
method: secp256k1 / x25519 ([SSP 2.9.27]) / p256 ([SSP 2.9.27]; NIST P-256 = secp256r1 = prime256v1)
Argument2
private key (32 bytes; default format is hex)
Argument3
other party's public key (default format is hex)
Options
--key-in= / --peer-in= / --out= (default is hex)

Keys are raw values, not DER / PEM.

secp256k1
The other party's public key can be 32 bytes containing only the x-coordinate (BIP-340 / nostr format), 33 bytes in compressed form, or 65 bytes in uncompressed form.
x25519
Both the private key and the other party's public key are 32 bytes (RFC 7748. SSP applies the private key bit adjustments (clamping)). Public keys that produce an all-zero result (low-order points) are rejected.
p256
The other party's public key must be 33 bytes in compressed form (starting with 02 or 03) or 65 bytes in uncompressed form (starting with 04). A 32-byte x-coordinate alone is not accepted (unlike secp256k1, this is not a valid form for a P-256 public key).

If the private key is out of range (0 or greater than or equal to the order; for x25519, not 32 bytes), or if the other party's public key is not a point on the curve or has the wrong length, the result is 400 (invalid key). Keys for x25519 / p256 can be generated with GenerateKeyPair.

Example

Argument0: KeyAgreement
Argument1: secp256k1
Argument2: 315e59ff51cb9209768cf7da80791ddcaae56ac9775eb25b6dee1234bc5d2268
Argument3: c2f9d9948dc8c7c38321e4b85c8558872eafa0641cd269db76848a6073e69133

→ Result: 5ad01c0fc57ed5f92a0518b6440ca876eb1f247ddbb237ba1caaabbf4cebbdce
Argument0: DeriveKey
Argument1: hkdf-extract
Argument2: 5ad01c0fc57ed5f92a0518b6440ca876eb1f247ddbb237ba1caaabbf4cebbdce
Argument3: nip44-v2
Argument4: 32
Argument5: --password-in=hex

→ Result: 3dfef0ce2a4d80a25e7a328accf73448ef67096f65f79588e358d9a0eb9013f1

(NIP-44 conversation key. NIP-44 test vector)

Argument0: KeyAgreement
Argument1: x25519
Argument2: 77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a
Argument3: de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f

→ Result: 4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742

(RFC 7748 §6.1 test vector. For p256, use i from RFC 5903 §8.1 as the private key and 04 + the x and y coordinates of gr as the other party's public key to obtain d6840f6b42f6edafd13116e0e12565202fef8e9ece7dce03812464d04b9442de)

  • SSP2.9.14 (x25519
  • p256 are SSP 2.9.27)

internal_random

Cryptographically secure random numbers (OpenSSL's RAND_bytes).

Bytes

Return a random byte string. Use it to generate salts, tokens, and similar values.

Argument1
Number of bytes (1–1024; out of range returns 400 out of range)
Options
--out= (default is hex)
  • SSP2.9.13
Number

Select one integer uniformly at random from the inclusive range between the minimum and maximum. Supports the range of signed 64-bit integers. If the minimum is greater than the maximum, return 400 (invalid parameter).

Argument1
Minimum
Argument2
Maximum
  • SSP2.9.13
UUID

Return a UUID (RFC 9562) in lowercase canonical form (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
Version 4 is entirely random. For version 7, the first 48 bits represent the current time (UNIX time in milliseconds), making UUIDs easier to sort in creation order (ordering within the same millisecond is not guaranteed).

Options
--version=4 (default) / --version=7 (any other value returns 400 invalid parameter)
  • SSP2.9.13

internal_time

Date-time formatting and calculations. Internally, date-times are handled as UTC epoch seconds (seconds since 1970-01-01T00:00:00Z, in the same units as YAYA's GETSECCOUNT).

Date-time arguments

A date-time argument must be written in one of the following forms. If it cannot be parsed as any of them, the result is 400 (invalid parameter). Nonexistent dates (such as February 30) also result in 400.

Integer
Epoch seconds. Negative values (before 1970) are allowed.
now
The current time.
ISO 8601
Examples: 2026-10-11, 2026-10-11T21:00:00+09:00, 2026-10-11 21:00, and 20261011T210000Z. Fractional seconds are discarded.
Values without a zone (Z or +09:00) are interpreted as times in the --tz= zone. For how times during daylight saving transitions—times that occur twice or do not exist—are handled, see Zones.
HTTP date
Examples: Sun, 11 Oct 2026 12:00:00 GMT.

The supported range is 0001-01-01 to 9999-12-31 in UTC (from 1601 onward when --tz=local). Values outside this range result in 400 (out of range).
However, ISO 8601 and HTTP date strings can only represent dates from 1601 onward (earlier dates result in 400 invalid parameter; they can be specified as integer epoch seconds).
The range is determined in UTC, so formatting dates near 9999-12-31 in an eastern zone (such as +09:00) may produce a five-digit year, 10000.

Zone (--tz=)

local
(default) The OS time zone. Applies daylight saving time for the given date and time.
UTC / Z
UTC.
+09:00 / +0900 / +09
Offset from UTC (up to ±18:00).
Named zones
An IANA time zone name (such as Asia/Tokyo or America/New_York) or a Windows time zone name (such as Tokyo Standard Time). Case-insensitive. Applies daylight saving time for the given date and time.
Zone rules use the OS (Windows) time zone information. IANA names are mapped to Windows names using the Unicode CLDR mapping table. A name not available on the OS returns 400 (invalid parameter). It is not treated as UTC.

Rules for named zones are limited to the scope of the OS time zone information. For historical rules not included in the OS information (often those from before the 2000s), the rules for the earliest year available on the OS are used instead.

Before and after daylight saving time transitions

When converting a zoned date and time (wall-clock time) to UTC (when reading a zone-less ISO 8601 date and time, or when calculating the result of adding day or a larger unit in Add), times around daylight saving time transitions can be ambiguous. For both local and named zones, regardless of whether the zone is west (negative offset) or east (positive offset), the following rules apply. [SSP 2.9.27]

A time that occurs twice
(the day the clock goes back at the end of daylight saving time): Use the earlier occurrence, that is, the time still in daylight saving time. For example, 2026-11-01T01:30 in America/New_York is 2026-11-01T01:30:00-04:00.
A nonexistent time
(the day the clock moves forward at the start of daylight saving time): Interpret it using the pre-transition offset, resulting in a time after the transition. For example, 2026-03-08T02:30 in America/New_York is 2026-03-08T03:30:00-04:00, and 2026-03-29T02:30 in Europe/Berlin is 2026-03-29T03:30:00+02:00.

Before [SSP 2.9.26], in zones with a negative offset, a nonexistent time was moved back by one hour (02:30 in America/New_York became 01:30-05:00). The choice of occurrence for times that happened twice was also reversed between zones east and west of UTC.

Format

Formats a date-time in the --tz= zone. Weekday and month names are fixed in English (independent of language and regional settings).

Argument1
Date-time
Argument2
Format (defaults to iso8601 if omitted or empty)
Options
--tz=

The format can be one of the following names or a format using %. An unknown format name or % character results in 400 (invalid parameter).

iso8601 / rfc3339
2026-10-11T21:00:00+09:00. If the offset is 0, the suffix is Z.
http
Sun, 11 Oct 2026 12:00:00 GMT. Always uses GMT, regardless of --tz=.
epoch / epochms
Epoch seconds / epoch milliseconds.
% format
%Y (four-digit year) %y (two-digit year) %m (month) %d (day) %H (hour) %M (minute) %S (second) %j (day of year) %u (weekday, Monday=1 to Sunday=7) %w (weekday, Sunday=0 to Saturday=6) %a (Sun) %A (Sunday) %b (Jan) %B (January) %z (+0900) %:z (+09:00) %s (epoch seconds) %% (%).
Characters other than % are output as-is.

Example

Argument0: Format
Argument1: 0
Argument2: %Y/%m/%d %H:%M (%a)
Argument3: --tz=+09:00

→ Result: 1970/01/01 09:00 (Thu)
  • SSP2.9.13
Add

Returns the date-time obtained by adding an amount to a date-time, in epoch seconds. The amount may be negative.
second / minute / hour are added as elapsed time. day and larger units are added using the calendar in the --tz= zone (so the time remains the same even when crossing a daylight saving transition).
Dates are clamped to the end of the month (January 31 + 1 month = February 28 or 29).
If the result is a nonexistent time during a daylight saving transition (a time skipped when the clock moves forward), it becomes the time after the transition. If the result is a time that occurs twice, the earlier one is used (see Before and after daylight saving transitions).

Argument1
Date-time
Argument2
Amount (integer)
Argument3
Unit: secondminutehourdayweekmonthyear (plural forms such as days are also allowed)
Options
--tz=
  • SSP2.9.13
Diff

Returns the integer difference between date-time 2 and date-time 1, counted in the specified unit. Fractions are truncated toward zero.
day and larger units are counted using the calendar in the --tz= zone. For example, if date-time 2 is specified as a date only (midnight that day), the number of days remaining decreases by one at midnight in the --tz= zone. month / year are counted in calendar months; the result is the largest number that can be added with Add without passing date-time 2 (from January 31, one month later is the same time on February 28 in a common year, or February 29 in a leap year).

Argument1
Date-time 1
Argument2
Date-time 2
Argument3
Unit (same as Add)
Options
--tz=

Example

Argument0: Diff
Argument1: 2026-12-20T10:00
Argument2: 2026-12-24
Argument3: day

→ Result: 3(3日と14時間なので3)

If you need the difference between calendar dates (that is, “how many days from today”), specify date-time 1 as a date only as well (you can create today's date with %Y-%m-%d in Format).

  • SSP2.9.13

internal_text

String processing.

Normalize

Normalizes a string to a Unicode normalization form. Use this to make strings with different code points but the same appearance consistent before comparing them, such as half-width and full-width katakana or precomposed characters and sequences of combining characters.
Uses OS functionality (NormalizeString on Windows Vista and later; on XP, uses normaliz.dll from the IDN add-on package if available). Returns 500 (internal error) on operating systems where this is unavailable. Results may vary depending on the OS's Unicode version. An empty string returns an empty string (204). A string containing an unpaired surrogate results in 400 (invalid encoding).

Argument1
Form: NFC / NFD / NFKC / NFKD (case-insensitive; anything else results in 400 unsupported algorithm)
Argument2
String

Example

Argument0: Normalize
Argument1: NFKC
Argument2: ガイド①

→ Result: ガイド1
  • SSP2.9.13

internal_jwt

Creation and verification of JWTs (RFC 7519). The format is limited to the compact form of JWS (header.payload.signature).
The supported algorithms are as follows (case-insensitive in arguments and --alg=). Any other value, including none, returns 400 (unsupported algorithm).

Sign

Sign the payload to create a JWT.
The payload must be a JSON object and is used as written (in UTF-8). If it is not a single JSON object, return 400 (invalid parameter).
The header has the form {"alg":"HS256","typ":"JWT"}. Add header fields such as kid by writing a JSON object in --header= (if typ is specified, it takes precedence; if alg is specified, it must match Argument1 or return 400 invalid parameter).

Argument1
alg
Argument2
Key (symmetric key for HS*, private key otherwise)
Argument3
Payload (JSON)
Options
--header= (JSON) / --key-in= (HS* only)

Example

Argument0: Sign
Argument1: HS256
Argument2: 0123456789abcdef0123456789abcdef
Argument3: {"sub":"sakura","exp":4102444800}

→ Result: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzYWt1cmEiLCJleHAiOjQxMDI0NDQ4MDB9.eJKcQzLKm4FjTltXWvPqonVpfwhVaBgpvf9nZw0szuM
  • SSP2.9.14
Verify

Verify the JWT signature and expiration, and return the payload (JSON) if valid. If the payload contains line breaks, replace them with spaces before returning it (this does not change its meaning as JSON).
--alg= must always be specified (if omitted, return 400 invalid parameter). Do not trust the token header's alg; fail if it does not match the specified value (to prevent algorithm substitution or forgery using none).
Check exp (expiration time) and nbf (time before which the token is not valid) if present. Other fields such as iss, aud, and iat are not checked; check them in a script if needed.

Argument1
Token
Argument2
Key (symmetric key for HS*, public key otherwise)
Options
--alg= (required) / --leeway= (seconds; allowed clock skew; default is 0; range 0–86400) / --key-in= (HS* only) / --time= (date and time to use instead of the current time. Use the same format as the date-time argument for internal_time. Defaults to the current time)

Failures are as follows.

500 authentication failed
Signature does not match. Header alg differs from --alg= (case-sensitive). Header contains crit. Token is malformed (not split into 3 parts, not readable as base64url, header or payload is not a JSON object, or invalid UTF-8). exp / nbf is not numeric.
500 expired
Current time is at or after exp + leeway (the token expires exactly at the time specified by exp).
500 not yet valid
Current time + leeway is earlier than nbf.
400 invalid key
Key cannot be read, is of the wrong type, or is too short for HS*.

Example

Argument0: Verify
Argument1: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzYWt1cmEiLCJleHAiOjQxMDI0NDQ4MDB9.eJKcQzLKm4FjTltXWvPqonVpfwhVaBgpvf9nZw0szuM
Argument2: 0123456789abcdef0123456789abcdef
Argument3: --alg=HS256

→ Result: {"sub":"sakura","exp":4102444800}
  • SSP2.9.14

internal_file

Operations on files themselves. (For operations that only read a file's contents as a byte sequence, use the options accepted by each function, such as --data-in=file for Digest / HMAC in internal_crypto.)

MediaInfo

Gets the tags, duration, and dimensions of an audio or video file without loading the file (without preparing to play it; only the header and tags are read). The values can be read using only the path, without creating an element with \![sound]. No elements are added to the sound.* list, no OnSound* events are fired, and no temporary files are created. [SSP 2.9.27] Read image dimensions with ImageInfo. Handling of image files passed to MediaInfo is not guaranteed (as of [SSP 2.9.25], SSP still returns the image's Result and width / height).
Values may not be available depending on the environment. [SSP 2.9.32] SSP reads MP3 and other ID3 tags (v1 / v2.2 / v2.3 / v2.4), FLAC, Ogg Vorbis, and Opus comments, and WAV / AVI INFO tags itself. For other formats (such as MP4, WMA, and MKV / WebM) and items SSP could not read, it relies on the OS property handler (the same mechanism used to show file details in Explorer). Therefore, values are empty if the OS has no handler for the format, or if the handler does not return certain items (these cases cannot be distinguished from a file without tags). Failure to retrieve a value does not result in an error.
Note that a synchronous call pauses the ghost while reading. Reading may take time depending on where the file is stored (such as on a network drive), so consider using --async.

Argument1
File path. Relative paths are based on the ghost folder (ghost/master). Both / and \ can be used as separators. Passing a relative path in a call without a ghost returns 400 (ghost required). If the file does not exist (including if the path is a folder), returns 400 (file not found). URLs are not accepted.
Argument2 and later
Keys for the values to retrieve. At least one key is required (if none are specified, returns 400 invalid parameter), and up to 11 keys are allowed (12 or more returns 400 invalid parameter). Keys are case-insensitive.

The keys are as follows. All values are strings (numeric values are decimal integers). Tag items have the same names and meanings as sound.(element name).meta.*.

title / artist / albumartist / album / genre / comment
String.
year
Four-digit Gregorian year. If the original value is a full date, the first four digits are used.
track
Integer track number only. Does not include the total number (3/12 becomes 3).
duration
Audio or video duration (milliseconds). Empty for images. May be an estimate for VBR MP3 and similar formats.
width / height
Dimensions in pixels (px). For video, the video dimensions. Empty for audio. Video consisting only of embedded artwork, such as album art, is not counted as video.

The response's Result indicates the media type and is either audio or video. It is empty if the type cannot be determined. [SSP 2.9.32] The type is also determined from the file contents for Ogg, Opus, WebM, and other formats where the OS does not return a type (Matroska / WebM is video if it has a video track, and audio otherwise). The type is only a guide, so Value may still be populated when Result is empty. Do not branch on Result; check whether Value is empty. More types may be added in the future.
Value0 and later correspond in order to the keys listed in Argument2 and later. Values that could not be retrieved and unknown keys return an empty string (this is not an error; implementation-specific keys are not returned). Unreadable or unsupported formats do not return 400; instead, they return 200 with both Result and all Value fields empty.

  • Newlines in values are replaced with byte value 0x01 (CRLF is replaced with a single 0x01; LF and CR alone are each also replaced with a single 0x01). NUL characters are removed.
  • Tags with multiple values (such as multiple artists) are joined into a single string with ; (a semicolon and two half-width spaces).
  • The response character encoding follows the request's Charset.
  • [SSP 2.9.32] For tags that SSP reads itself and that do not specify a character encoding (ID3v1, ISO-8859-1 in ID3v2, and WAV / AVI INFO), SSP tries to determine the encoding in this order: UTF-8 → Shift_JIS → the OS default character encoding. Since this is an estimate, Western European text may be mistaken for Japanese, especially on non-Japanese OSes. Character encoding detection for tags in formats SSP does not read itself is left to the OS, and may result in garbled text.
  • Which items can be retrieved for each format varies by OS environment. In testing with SSP, most tags and video dimensions in MKV / WebM could not be retrieved in the standard Windows 11 environment (as of [SSP 2.9.32], SSP reads WAV tags and MP3 comments itself, so these can be retrieved).

Example

Argument0: MediaInfo
Argument1: sound/bgm01.mp3
Argument2: title
Argument3: artist
Argument4: duration
Argument5: --async=OnMediaInfo

→ 204(結果はOnMediaInfoイベントで届く)
 Reference0: OnMediaInfo
 Reference1: audio
 Reference2: internal_file
 Reference3: MediaInfo
 Reference4: タイトル
 Reference5: アーティスト
 Reference6: 215000
  • SSP2.9.25
ImageInfo

Gets the dimensions of an image file without loading the file (by reading only its header). The image can be read from its path alone, without creating a surface or anything similar.
The information may not be available in some environments. SSP first reads it using the OS property handler (the same mechanism used for file details in Explorer); if that fails, SSP reads only the file header itself (without decoding the image). The formats whose dimensions can be read from the header are PNG (APNG) / JPEG / GIF / BMP / TIFF / WebP / ICO and CUR (largest entry) / PSD / XCF / PSP (version 4.0 and later) / QOI / PCX / TGA / PBM / PGM / PPM / PAM / PFM / XBM / XPM / MAG / PI. For ORA / KRA / CLIP (formats whose dimensions can only be determined by decompressing the contents), the result is empty if no OS handler is available. Failure to retrieve the information is not an error.
When reading from the header, the dimensions are for the first page of TIFF files, the logical screen of GIF files, and the largest entry of ICO and CUR files. EXIF orientation (rotation) is not applied.
Note that calling this synchronously stops the ghost while the file is being read. Reading can take time depending on where the file is stored (for example, on a network drive), so consider using --async as well.

Use MediaInfo to read audio and video tags and durations.

Argument1
File path. Relative paths are based on the ghost folder (ghost/master). Both / and \ can be used as separators. If a relative path is passed in a call without a ghost, the result is 400 (ghost required). If the file does not exist (including if the path is a folder), the result is 400 (file not found). URLs are not accepted.
Argument2 onward
Keys for the values to retrieve. At least one is required (if none are specified, the result is 400 invalid parameter), and up to 11 can be specified (12 or more results in 400 invalid parameter). Keys are case-insensitive.

The keys are as follows. Values are decimal integer strings.

width / height
Image dimensions in pixels (px).

The response Result is image if the file is identified as an image, or empty otherwise. If it cannot be identified as an image (including audio and video files), all Value fields are empty.
Value0 onward correspond in order to the keys listed from Argument2 onward. Values that could not be retrieved and unknown keys return an empty string (this is not an error; implementation-specific keys are not returned). Unsupported or unreadable formats do not result in 400; instead, 200 is returned with both Result and all Value fields empty.
The response character encoding follows the request's Charset.

Example

Argument0: ImageInfo
Argument1: image/bg01.png
Argument2: width
Argument3: height

→ 200
 Result: image
 Value0: 640
 Value1: 480
  • SSP2.9.27
IsMediaLoadable

Checks whether SSP can handle an audio or video file. Determines this from the extension without loading the file.
The check uses the same component as the check for whether an audio or video file can be opened in the built-in media player when dragged and dropped onto SSP (the set of extensions that OS DirectShow / Media Foundation may be able to play). Since the file contents are not checked, a file may not actually be playable even if the result is read.
Images always return none, regardless of format. Images readable by SSP's built-in loader (including those identified as images by the header at the start of the file, not just by their extension) and images with extensions readable by OS WIC (such as HEIC) return none here, even if their extensions appear in the OS DirectShow extension table. In other words, images for which IsImageLoadable returns embed / write, and images that return read based on their extension, return none from this function. Use IsImageLoadable to check whether an image can be read.

Argument1
File path. Relative paths are based on the ghost folder (ghost/master). Both / and \ can be used as separators. Passing a relative path in a call without a ghost returns 400 (ghost required). If the file does not exist (including if the path is a folder), returns 400 (file not found). URLs are not accepted.

The response's Result indicates the handling level and is one of the following.

none
Cannot be read. The file is not audio or video (images always return this), or is in an unsupported format.
read
Read-only. The format is likely to be playable.
embed
Can be processed as part of a ghost. This is not currently returned.
write
Can also be written. This is not currently returned.

The same four levels as IsImageLoadable are used. Each subsequent level includes the previous levels. Since embed and write may be returned in the future, it is safer to check whether the result is not none rather than whether it equals read.

Example

Argument0: IsMediaLoadable
Argument1: sound/bgm01.mp3

→ 200
 Result: read
  • SSP2.9.27
IsImageLoadable

Checks how well SSP can handle an image file. Determines this from the header and extension without loading the file. This function lets a ghost check in advance whether an image can be used as a surface or balloon image, or whether it can be saved.
The check uses the same component as the check for whether an image file can be opened in the built-in picture viewer when dragged and dropped onto SSP.

Argument1
File path. Relative paths are based on the ghost folder (ghost/master). Both / and \ can be used as separators. Passing a relative path in a call without a ghost returns 400 (ghost required). If the file does not exist (including if the path is a folder), returns 400 (file not found). URLs are not accepted.

The response's Result indicates the handling level and is one of the following.

none
Cannot be read. The file is not an image or is in an unsupported format.
read
Read-only. The format can be read, but it is not guaranteed to be processable as a ghost or balloon asset. In SSP, this applies to formats that the built-in loader cannot read but the OS image codec (WIC) can. These can be displayed in a viewer, but only the first frame is shown, and their use as surfaces, etc. is not guaranteed.
embed
Can be processed as part of a ghost or balloon. The format can be used for surface or balloon images. In SSP, this applies to formats that the built-in loader can read.
write
Can also be written. In addition to being embeddable, SSP can save images in this format (PNG / BMP / JPEG / WebP). Animated PNG and encrypted PNG are excluded.

Each subsequent level includes the previous levels (write also means embed). As with the actual loader, the check prioritizes the leading header, and checks the extension if the header is inconclusive. EXE / DLL files (used for extracting icons) are not counted as images.
The level may vary depending on the SSP version and OS environment. More levels may be added in the future.

Example

Argument0: IsImageLoadable
Argument1: image/bg01.png

→ 200
 Result: write
  • SSP2.9.27
CompressArchive

Compresses a folder into a ZIP file (or 7z file). This makes the same processing as CompressArchive in SSTP EXECUTE available through SAORI over DirectSSTP.
The archive format is determined by the extension of the destination path. .7z produces a 7z archive (compressed using LZMA); all other extensions produce ZIP archives (specifying .lzh or .cab still produces a ZIP archive).
Archive processing may take several seconds, so --async is strongly recommended. If called synchronously, the ghost stops during processing.

Argument1
Path to the destination archive. Relative paths are based on the ghost folder (ghost/master). Both / and \ can be used as separators. If a relative path is passed in a call without a ghost, the result is 400 (ghost required).
Argument2
Path to the folder to compress (files inside it are included recursively, but hidden files and hidden folders, including their contents, are excluded). Written the same way as Argument1. If it does not exist, the result is 400 (file not found). This path is not limited to folders managed by SSP; folders outside its management can also be compressed (only the destination is restricted). [SSP 2.9.33] Passing something that is not a folder (such as a file path) results in 400 (invalid parameter). Before this version, passing a file path failed with 500 (file not found).

The options are as follows (if the same name is specified twice, the later one takes effect).

  • --password=password……Encrypts using the specified password (for ZIP, this is an AES-encrypted ZIP).
  • --option=option……Specify the following values together as a single comma-separated value (for example, --option=overwrite,lzma. If you specify --option= twice, only the later one takes effect).
    overwrite……Replaces the destination archive if it already exists.
    append……Adds to the destination archive if it already exists.
    lzma……Compresses using LZMA (for ZIP only. 7z always uses LZMA, so this has no effect).
    headerencrypt……Also encrypts the header (the list of filenames; requires --password=). Works only for 7z and has no effect on ZIP (filenames remain unencrypted in ZIP).
    If the destination archive already exists and neither overwrite nor append is specified, the result is 400 (file exists).

On success, the result is 200. Result contains the number of files compressed, Value0 contains the size in bytes after compression, and Value1 contains the size in bytes before compression (after extraction); all are decimal integers. These are the same values as Reference1 through Reference3 in OnCompressArchiveComplete for SSTP EXECUTE. With --async, they are returned in Reference1 (Result) and Reference4 and Reference5 (Value0 and Value1).
For ZIP, Value0 is the number of bytes added to the archive (including the header and central directory; with append, only the additional data). It is slightly larger than the size of the compressed data alone.
[SSP 2.9.26] The file count and byte counts are also returned correctly for ZIP (in [SSP 2.9.25], they were 0 when compressing to ZIP).

Failures are as follows. 400 indicates file not found (source does not exist) / invalid parameter (insufficient arguments, empty path, invalid option, or, in [SSP 2.9.33], source is not a folder) / ghost required / file exists / path not allowed (destination is outside folders managed by SSP). 500 indicates the reason for compression failure, such as open failed.

For security reasons, the destination is restricted to locations under folders managed by SSP (such as the ghost folder, balloon folder, and locations specified by the “Folder” settings). The path is checked after resolving .. and similar components. This restriction may be tightened as needed, so it is safest to limit the destination to a folder under the one containing the ghost's own data.

Example

Argument0: CompressArchive
Argument1: save/backup.zip
Argument2: save/data
Argument3: --option=overwrite
Argument4: --async=OnBackupDone

→ 204(結果はOnBackupDoneイベントで届く)
  • SSP2.9.25
ExtractArchive

Extracts an archive (in addition to ZIP, this includes formats such as 7z and tar; see “Supported formats” below). This makes the same operation as ExtractArchive in SSTP's EXECUTE callable through SAORI over DirectSSTP.
Archive processing may take several seconds, so --async is strongly recommended. If called synchronously, the ghost will stop while it runs.

Argument1
Path to the archive to extract. Relative paths are based on the ghost's folder (ghost/master). Both / and \ can be used as separators. A relative path passed in a call without a ghost results in 400 (ghost required). If the file does not exist (including a folder), the result is 400 (file not found).
Argument2
Path to the folder to extract into. The format is the same as for Argument1. If the folder does not exist, it is created (if creation fails, the result is 500 create directory failed).

The options are as follows.

  • --password=password [SSP 2.9.26]……Extracts a password-protected ZIP using the specified password. If a password is required but none is specified, or if the password is incorrect, extraction fails with 500 (password mismatch) without showing a password prompt (in [SSP 2.9.25], a password could not be specified, and a password prompt appeared, stopping the ghost).
  • --async

On success, the response is 200, with the number of extracted files in Result, the compressed size in bytes in Value0, and the extracted size in bytes in Value1 (integers in decimal). These are the same values as Reference1–Reference3 in OnExtractArchiveComplete for SSTP's EXECUTE; with --async, they are returned in Reference1 (Result) and Reference4 and Reference5 (Value0 and Value1).
For archives such as 7z that do not store the compressed size for each entry, Value0 may be 0.
[SSP 2.9.26] ZIP archives containing multiple files also return the correct total (in [SSP 2.9.25], the size was that of the last file only).

Failures are as follows. 400 indicates file not found (the archive to extract does not exist) / invalid parameter (an argument is missing or a path is empty) / ghost required / path not allowed (the extraction destination is outside SSP-managed folders). 500 indicates create directory failed or the reason extraction failed (open failed, crc, password mismatch, etc.).

For security reasons, the extraction destination is restricted to locations under SSP-managed folders (locations specified in the “Folders” settings, such as ghost and balloon folders). Paths are checked after resolving .. and similar components. Also, since this restriction may be strengthened as appropriate, it is safest to limit the destination to a folder containing the ghost's own data.

Supported formats

The archive format is determined by the file name extension (for self-extracting exe files, the contents are inspected and the ZIP or 7z archive inside is extracted). If the format cannot be determined, extraction fails with 500.

ZIP
.zip.zipx.nar
LZH
.lzh.lha
CAB
.cab
7z
.7z
tar formats
.tar.tar.gz(.tgz) .tar.xz(.txz) .tar.bz2(.tbz2.tbz) .tar.lzma(.tlz) .tar.zst(.tzst) .tar.br(.tbr) .tar.Z(.taz) .cpio.deb.udeb.rpm
Single-file compression
.gz.bz2.xz.lzma.zst.zstd.br.Z (extracted as an archive containing one file)
Disk images
.iso.img
Mail
.eml
Self-extracting
.exe

--password= applies only to ZIP and 7z; it is ignored for other formats.

Example

Argument0: ExtractArchive
Argument1: save/backup.zip
Argument2: save/restore
Argument3: --async=OnRestoreDone

→ 204(結果はOnRestoreDoneイベントで届く)
 Reference0: OnRestoreDone
 Reference1: 12(展開したファイル数)
 Reference2: internal_file
 Reference3: ExtractArchive
 Reference4: 圧縮後のバイト数
 Reference5: 展開後のバイト数
  • SSP2.9.25

Notes for Baseware Implementing MediaInfo

MediaInfo is limited to what can be implemented without difficulty in baseware on other operating systems using existing components (ffprobe / libavformat, TagLib, standard OS media APIs, etc.).

Required (MUST)
The names, units, and forms of the keys above; use an empty string for values that could not be retrieved; value formatting (line breaks as 0x01, removal of NUL); the base for relative paths (ghost/master); response form (Result + Value0..); leave keys not specified in the specification empty and do not return custom keys; accept / as a path separator.
Recommended (SHOULD)
Also accept \ as a path separator (ghost authors use \, but on other operating systems \ may be an ordinary character in a filename). Join tags with multiple values using ;.
May vary by implementation
Supported formats (additional formats such as ICO and HEIC are fine if they can be retrieved; not retrieving them is not a defect); estimation of the character encoding of original tags; accuracy of VBR duration; how Result is determined; which items can be retrieved from which formats. The mapping of tags by format (for example, ID3v2's TIT2 becoming title) is not specified.
How to check conformance
Any values returned must be correct. Returning no value (empty) passes. An error margin is allowed for duration (as a guideline, ±100 milliseconds or 1%).

Guidelines for implementation with ffprobe / libavformat:

  • duration is format.duration. width / height are the values from the video stream for video.
  • Ogg and Opus tags are in streams[].tags, not format.tags.
  • Embedded cover images in MP3 and M4A are reported as video streams with attached_pic. If these are counted as video, audio files will end up as video.
  • track (in the form 3/12) and date (in the form 2024-05-06) need to be normalized to the specification's forms: track (track number only) and year (first 4 digits).

Implementing ImageInfo / IsMediaLoadable / IsImageLoadable

  • ImageInfo follows the same rules as MediaInfo (keys, units, empty strings for values that could not be retrieved, and path handling). Set Result to image only when the image's pixel dimensions can be retrieved, and leave all Value fields empty for audio and video files.
  • The four levels of IsMediaLoadable / IsImageLoadable (none / read / embed / write) describe the capabilities of the baseware itself. embed means “can be incorporated into and processed by ghosts or balloons” (that is, the baseware can load it as a resource such as a surface or balloon image, or audio for \![sound]). write means “can be written in that format.” read is for formats that can be read, but are not guaranteed to be incorporated and processed; in SSP, this applies to formats for which it has no built-in loader and instead relies on OS codecs. In implementations that use their own loaders to read resources, most readable formats will be embed, so read need not be returned if there are no formats that qualify as read. Higher levels include the lower levels.
  • The basis for the determination (header or extension) is not specified. If the file does not exist or is a folder, return 400 (file not found); otherwise, do not return an error, and return none if the file cannot be read.

internal_system

A list of built-in modules and how to call their functions. Use this to check from a script which functions are available and which options and algorithm names can be used.
Only modules whose names begin with internal_ appear in the list (compatibility modules do not appear).
The results of ListModules / ListFunctions are comma-separated in Result, with one item each from Value0 onward. The order has no meaning.

ListModules

Returns a list of the names of built-in modules (including internal_system itself).

引数
None

Example

Argument0: ListModules

→ Result: internal_crypto,internal_random,internal_time,internal_data,internal_text,internal_jwt,internal_system,internal_file
→ Value0: internal_crypto
→ Value1: internal_random
…
  • SSP2.9.14
ListFunctions

Returns a list of function names in the specified built-in module. Function names are returned in their canonical spelling (including letter case).
A name that is not a built-in module (including compatibility modules) results in 400 (unknown module).

Argument1
Module name (case-insensitive)

Example

Argument0: ListFunctions
Argument1: internal_jwt

→ Result: Sign,Verify
→ Value0: Sign
→ Value1: Verify
  • SSP2.9.14
Describe

Returns how to call a function in a built-in module (number of positional arguments, accepted options, and choices selected by name).
Functions in built-in modules fail with 400 (invalid parameter or unsupported algorithm) if passed an unknown option or algorithm name. This is what happens when you use an option or algorithm added in a newer SSP with an older SSP. Checking in advance with this function lets you determine whether it is available without calling it. ListFunctions only tells you whether the function exists.

Argument1
Module name (case-insensitive)
Argument2
Function name (case-insensitive)

A name that is not a built-in module (including compatibility modules) results in 400 (unknown module); a function name that does not exist in that module results in 400 (unknown function). If either is missing, the result is 400 (invalid parameter).

The results are as follows.

Result
Function name (canonical spelling).
Value0
Maximum number of positional arguments. This is the number of arguments from Argument1 onward that can appear before any options. For functions with a variable number of positional arguments (such as MediaInfo in internal_file), this is the upper limit.
Value1
Number of required positional arguments.
Value2
1 if the number of positional arguments is variable, or 0 if it is fixed. For functions with a variable number of positional arguments, values from the second positional argument onward, starting with the first value that begins with --, are read as options (common conventions).
Value3
Comma-separated names of the accepted options, without the -- prefix. This includes async, which is accepted by every function. Options in the form --データ名-in= (such as data-in and key-in) are listed as-is.
Value4 and later
If any arguments or options must be selected from a fixed set of choices, each has one value. The format is name=choice|choice|…; the name is Argument1 and so on for a positional argument (using the same number as the request's ArgumentN), or an option such as --digest. Choices use the same spelling as in each function's description. Functions without a fixed set of choices have no Value4 or later.

Names in forms such as --out= and --data-in= (common conventions), and the format names for Format, are not included as choices.

Example

Argument0: Describe
Argument1: internal_crypto
Argument2: KeyAgreement

→ Result: KeyAgreement
→ Value0: 3
→ Value1: 3
→ Value2: 0
→ Value3: key-in,peer-in,out,async
→ Value4: Argument1=secp256k1|x25519|p256

From this result, you can determine whether x25519 is available by splitting Value4 at = and | and checking whether x25519 is present.

  • SSP2.9.27

Compatibility modules

SSP includes compatibility implementations for the following commonly used SAORI DLLs. When a ghost loads one of these DLLs, SSP substitutes its built-in implementation without reading the DLL (determined by the file name).
[SSP 2.9.13] These can also be called from Direct SSTP using the name with .dll removed from the DLL name (such as Module: string). Arguments and return values are the same as in the original SAORI.

houchi clipcopy textcopy saori_ip saori_cpuid mciaudio cpuusage httpc string hanayu osuwari (osuwari from [SSP 2.9.33])

  • Direct SSTP has no load / unload, so modules that maintain state per ghost (mciaudio / httpc / string / hanayu) are initialized on that ghost's first call and discarded when the ghost exits (including when SHIORI is reloaded). They do not share state with instances loaded as DLLs.
  • Calls without a ghost return 400 (ghost required) for operations that depend on a ghost (httpc retrieval, saving, and bg; hanayu show; mciaudio load / play / loop / stop).
  • houchi works when loaded, so calling it from Direct SSTP does nothing.
  • Direct SSTP requests are processed on SSP's main thread, so use bg when retrieving data with httpc (otherwise, SSP's display freezes while the data is retrieved).

osuwari [SSP 2.9.33]

Compatible with ukiya's Osuwari.dll. It makes the ghost's window follow the foreground window, a specified window, or a screen rectangle (it performs the same operation as \![set,alignmenttodesktop,osuwari,…]; the meaning of the options is also described there). Arguments are positional, as in the original.

  • START: In order from Argument1: HWND to control / tracking target (ACTIVE FIX @title #handle) / origin (TL TR BL BR) / x offset / y offset / update interval (milliseconds; 0 means 100) / (optional) options (XMOVE YMOVE NOCLIP BACK, space-separated. BACK places the window immediately behind the target window. This option is not in the original) / (optional) fallback when it cannot be positioned (DESKTOP WORKAREA and CENTER LEFT RIGHT TOP BOTTOM, space-separated) / (optional) clipping margin (left_top_right_bottom).
    • If arguments from the 7th onward are omitted, their values from the previous START are retained. This is the same behavior as the original. With \![set,alignmenttodesktop,osuwari,…], omitted options are set to their defaults each time (not retained).
    • The HWND to control can only be the character window of that ghost, as reported by the OnHWND event (hwnd). Other windows are not moved (500 if it cannot be found).
  • STOP: Stops the positioning set by the SAORI and restores the ghost/shell default alignment (descript.txt). If the default in descript.txt is osuwari, it positions the window using osuwari again. It does not stop positioning set with \![set,alignmenttodesktop,osuwari,…]. It also stops when the SAORI is unloaded (including when SHIORI is reloaded).
  • Success returns 204; insufficient or unparseable arguments return 400; if the HWND to control cannot be found, it returns 500 (source window is not exist).
  • Differences from the original are as follows.
    • The window rectangle is measured using its visible frame.
    • The reference screen is the monitor containing the target window (clipping is checked against the combined area of all monitors).
    • The original bug that always sets side to TOP when DESKTOP is specified is not present.
    • It does not position the window on minimized or hidden windows.
    • There is no need to write seriko.alignmenttodesktop,free in the shell's descript.txt.
  • Renamed DLLs (such as osuwari0.dll) are not covered by this compatibility implementation. The actual DLL is loaded.