Decode and encode SAP SSO2 logon tickets — v2: corrected field semantics and SAP-verified signing, based on a real S/4HANA deployment
| Field | Value | Hex |
|---|
Identifies the token issuer, not the target system
When the token was created (defaults to now) — not an expiry. SAP rejects future timestamps and adds its own validity period.
For SAP to accept the token, the certificate must be SHA-1-signed
(openssl req -sha1 …). SHA-256-signed certificates import into STRUSTSSO2
without error but fail verification (SsfVerify returned 5).
Tokens are signed with SHA-1 digest, detached, without authenticatedAttributes —
the combination verified against S/4HANA with CommonCryptoLib 8.x.
MYSAPSSO2 is an SAP SSO2 logon ticket — a cookie-based Single Sign-On token used by SAP systems.
When a user authenticates to an SAP system, the server issues a signed ticket stored as the
MYSAPSSO2 browser cookie. Other SAP systems that trust the issuer's certificate can
accept the ticket for passwordless login.
The token is a base64-encoded binary blob with this layout:
| Offset | Content |
|---|---|
| 0 | Version byte (usually 0x02) |
| 1–4 | Codepage — 4 ASCII bytes (e.g. 4103) |
| 5…n | TLV (Tag-Length-Value) fields — see table below |
| n+1 | 0xFF end-of-fields marker |
| n+2…n+3 | Signature length — 2-byte big-endian uint16 |
| n+4… | PKCS#7 / CMS signature block (BER/DER encoded) |
Common TLV fields:
| ID | Name | Encoding |
|---|---|---|
| 0x01 | User | UTF-16LE text |
| 0x02 | System ID — issuer, not target | UTF-16LE text |
| 0x03 | Client — issuer, not target | UTF-16LE text |
| 0x04 | Creation time (not expiry — SAP adds its own validity period) | UTF-16LE YYYYMMDDHHmmss UTC |
| 0x05 | Signature Flags | Raw bytes (hex) |
| 0x06 | Recipient Info | UTF-16LE text |
| 0x09 | Short Info | UTF-16LE text |
MYSAPSSO2) or from an HTTP Authorization header.STRUSTSSO2.YYYYMMDDHHmmss UTC. This is not an expiry — SAP computes expiration as creation time + login/ticket_expiration_time (default 8h) and rejects tokens with a future creation date.Hard-won requirements from a real S/4HANA deployment (kernel 7.93, CommonCryptoLib 8.5.x). All of these fail silently at import time and only show up in kernel traces:
openssl req -sha1 …. A sha256WithRSAEncryption certificate imports into STRUSTSSO2 fine but verification fails with SsfVerify returned 5.SSF_API_SIGNER_ERRORS). This tool signs without them.Alg=SHA1; SHA-256 digests are rejected. DSA 1024 + SHA-1 works on all NetWeaver versions; RSA 2048 + SHA-1 works on CommonCryptoLib 8.x.invalid format: ticket creation date / HMskiCheckValidity failed.RZ11: login/accept_sso2_ticket = 1 on the accepting system.STRUSTSSO2 is client-dependent — import the certificate into the Certificate List in client 000, but add the ACL entry (issuer System ID + Client from the token) in the client users log into. The ACL table is TWPSSO2ACL (check via SM30). Missing entry: No entry in TWPSSO2ACL for SYS … and CLI ….SMICM → Administration → ICM → Exit Soft → Local (SAP Note 510007).sap-ssolist response header lacks r= entries, SSO ticket auth isn't active on that endpoint.