{"id":18470234,"url":"https://github.com/miwr/swpssh","last_synced_at":"2026-02-27T03:32:03.445Z","repository":{"id":252529361,"uuid":"840723482","full_name":"mIwr/SwPSSH","owner":"mIwr","description":"Protection System Specific Header (PSSH) box container swift impl","archived":false,"fork":false,"pushed_at":"2025-04-17T20:00:26.000Z","size":95,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-12T11:58:04.718Z","etag":null,"topics":["drm","nagra","playready","pssh","widevine"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mIwr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-10T13:45:20.000Z","updated_at":"2025-04-17T19:59:17.000Z","dependencies_parsed_at":"2025-05-09T00:12:18.036Z","dependency_job_id":"72865e64-e2b4-4607-924b-44fa8f8b2ac9","html_url":"https://github.com/mIwr/SwPSSH","commit_stats":null,"previous_names":["miwr/swpssh"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/mIwr/SwPSSH","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mIwr%2FSwPSSH","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mIwr%2FSwPSSH/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mIwr%2FSwPSSH/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mIwr%2FSwPSSH/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mIwr","download_url":"https://codeload.github.com/mIwr/SwPSSH/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mIwr%2FSwPSSH/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29883714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"online","status_checked_at":"2026-02-27T02:00:06.759Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drm","nagra","playready","pssh","widevine"],"created_at":"2024-11-06T10:13:22.477Z","updated_at":"2026-02-27T03:32:03.420Z","avatar_url":"https://github.com/mIwr.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwPSSH - Protection System Specific Header (PSSH) box container swift impl\n\n[![Swift Package Manager compatible](https://img.shields.io/badge/SPM-compatible-brightgreen.svg?style=flat\u0026colorA=28a745\u0026\u0026colorB=4E4E4E)](https://github.com/apple/swift-package-manager)\n[![Platform](https://img.shields.io/badge/Platforms-iOS%20%7C%20Android%20%7CmacOS%20%7C%20watchOS%20%7C%20tvOS%20%7C%20Linux-4E4E4E.svg?colorA=28a745)](#Setup)\n\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/apple/swift\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/language-swift-orange.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://cocoapods.org/pods/SwPSSH\"\u003e\n        \u003cimg src=\"https://img.shields.io/cocoapods/v/SwPSSH.svg?style=flat\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://cocoapods.org/pods/SwPSSH\"\u003e\n        \u003cimg src=\"https://img.shields.io/cocoapods/p/SwPSSH.svg?style=flat\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"./LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/cocoapods/l/SwPSSH.svg?style=flat\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## Content\n\n- [Introduction](#Introduction)\n\n- [Setup](#Setup)\n\n- [Getting started](#Getting-started)\n\n## Introduction\n\nThe library allows to parse/serialize PSSH boxes with Widevine, PlayReady or Nagra payload\n\nmacOS 10.13+, iOS 11.0+ and Windows are supported by the module code base. Other platforms (watchOS 4.0+, tvOS 11.0+, Linux, Android) have experimental support\n\n**Notice: XCode 15+ doesn't allow to use iOS 11, tvOS 11 as minimum deployment target during build process. So the mimimum deployment target for these platforms in your project must be 12 in fact.**\n**If you want to bypass this limitation, you have to roll back to XCode 14.** More info: [1](https://github.com/Alamofire/Alamofire/pull/3823), [2](https://github.com/realm/realm-swift/issues/8368#issuecomment-1737604011)\n\n### General PSSH box container schema\n\nPSSH is a standardized container that holds metadata specific to the protection system employed for securing digital content. Hence PSSH is a part of DRM signalling.\n\nPSSH DOES NOT contain the enryption key itself (it’s a secret), but it contains the necessary information about encryption, such as the key ID, the encryption scheme, and other information that is needed to obtain the key from a license server\n\n| Field name     | Type                | Description                                                                     | \n|----------------|---------------------|---------------------------------------------------------------------------------|\n| Box size       | UInt32 (Big endian) | Box container bytes count including 'box size' 4 bytes                          |\n| Magic header   | String (4 bytes)    | Constant box container magic header - \"pssh\" (0x70, 0x73, 0x73, 0x68)           |\n| PSSH version   | UInt8               | There are two versions of PSSH box: 0 (commonly used) and 1 (new 'recommended') |\n| Flags          | Bytes array (3)     | PSSH box bit flags                                                              |\n| System ID      | Bytes array         | Constant system UUID bytes array (16)                                           |\n| Key IDs count  | UInt32 (Big endian) | Common PSSH V1 key IDs count. Optional                                          |\n| Key IDs        | Bytes array         | Common PSSH V1 key IDs data. Optional                                           |\n| Init data size | UInt32 (Big endian) | PSSH box init data size in bytes                                                |\n| Init data      | Bytes array         | PSSH box init data. Contains payload instance raw data according system ID      |\n\n**System ID variants**\n\n| DRM Technology     | Identifier (System ID)               |\n|--------------------|--------------------------------------|\n| Widevine           | edef8ba9-79d6-4ace-a3c8-27dcd51d21ed |\n| PlayReady          | 9a04f079-9840-4286-ab92-e65be0885f95 |\n| Nagra              | adb41c24-2dbf-4a6d-958b-4457c0d27b95 |\n| FairPlay           | 94ce86fb-07ff-4f43-adb8-93d2fa968ca2 |\n| Common (Version 1) | 1077efec-c0b2-4d02-ace3-3c1e52e2fb4b |\n\nMore details you can find at [Axinom](https://docs.axinom.com/services/drm/technical-articles/pssh/)\n\n### PlayReady PSSH data schema\n\nMicrosoft DRM system. PlayReady init data mixes binary (PSSH data and inner records) and XML (Record header) formats\n\nBinary PlayReady PSSH data is a top-level model. Contains the next fields:\n\n| Field name     | Type                   | Description                                         | \n|----------------|------------------------|-----------------------------------------------------|\n| Init data size | UInt32 (Little endian) | Data bytes count including 'init data size' 4 bytes |\n| Records count  | UIn16 (Little endian)  | PlayReady records count                             |\n| Records' data  | Bytes array            | Records' data sequence                              |\n\nEach item in records data sequence contains the next fields:\n\n| Field name        | Type                   | Description                                                                  | \n|-------------------|------------------------|------------------------------------------------------------------------------|\n| Record type       | UInt16 (Little endian) | Record type key: 1 - Record header, 2 - Reserved, 3 - Embedded License Store |\n| Record value size | UIn16 (Little endian)  | Record object size in bytes                                                  |\n| Value data        | Bytes array            | Record object data. Contains payload instance raw data record type           |\n\nMore details you can find at [Microsoft docs](https://learn.microsoft.com/en-us/playready/specifications/playready-header-specification)\n\n### Widevine PSSH data schema\n\nWidevine PSSH data schema used from [protobuf model](https://github.com/devine-dl/pywidevine)\n\n### Nagra PSSH data schema\n\nNagra init data is Base64-encoded JSON string. Decoded JSON contains the next fields:\n\n| Field name    | Type        | Description           | \n|---------------|-------------|-----------------------|\n| Content ID    | String      | Nagra PSSH content ID |\n| Key ID        | Hex string  | Nagra PSSH key ID     |\n\n**Notice: Nagra PSSH data [supports converting to Widevine](./Sources/SwPSSH/Model/Nagra/NagraPsshData+WDVConverter.swift)**\n\n## Setup\n\n### Swift Package Manager\n\nSwPSSH is available with SPM\n\n```\n.package(url: \"https://github.com/mIwr/SwPSSH.git\", .from(from: \"1.2.2\"))\n```\n\n### CocoaPods\n\nSwPSSH is available with CocoaPods. To install a module, just add to the Podfile:\n\n- iOS\n```ruby\nplatform :ios, '11.0'\n...\npod 'SwPSSH'\n```\n\n- macOS\n```ruby\nplatform :osx, '10.13'\n...\npod 'SwPSSH'\n```\n\n- tvOS\n```ruby\nplatform :tvos, '11.0'\n...\npod 'SwPSSH'\n```\n\n- watchOS\n```ruby\nplatform :watchos, '4.0'\n...\npod 'SwPSSH'\n```\n\n## Getting started\n\nMain class for work with PSSH box containers is [PSSHBox](./Sources/SwPSSH/Model/PSSHBox.swift).\nIt provides methods for parsing and serializing general data on box containers.\nWhen you successfully parsed the PSSH box, you can transform init data to Widevine, PlayReady or Nagra\n\n```swift\nimport SwPSSH\n...\nlet pssh: PSSHBox? = PSSHBox.from(b64EncodedBox: PSSHBoxEncoded)\nlet playReadyPayload: PlayReadyPsshData? = pssh?.playReadyPayload//Tries to parse PlayReady PSSH data from raw init data\nlet wdvPayload: WidevinePsshData? = pssh?.wdvPayload//Tries to parse Widevine PSSH data from raw init data\nlet nagraPayload: NagraPsshData? = pssh?.nagraPayload//Tries to parse Nagra PSSH data from raw init data\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiwr%2Fswpssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiwr%2Fswpssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiwr%2Fswpssh/lists"}