pssh-box 0.2.4

Parsing and serialization support for PSSH boxes used in DRM systems
Documentation
// Copyright 2016 Google LLC. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
//
// This file defines Widevine Pssh Data proto format.

syntax = "proto2";

package widevine;

message WidevinePsshData {
  enum ProtectionScheme {
    UNSPECIFIED = 0;    // Defaults to 'cenc'
    CENC = 1667591779;  // 'cenc' (AES-CTR) = 0x63656E63
    CBC1 = 1667392305;  // 'cbc1' (AES-CBC) = 0x63626331
    CENS = 1667591795;  // 'cens' (AES-CTR subsample) =
                        // 0x63656E73
    CBCS = 1667392371;  //'cbcs' (AES-CBC subsample) = 0x63626373
  };

  enum Algorithm {
    UNENCRYPTED = 0;
    AESCTR = 1;
  };
  optional Algorithm algorithm = 1;
  repeated bytes key_id = 2;

  // Content provider name.
  optional string provider = 3;

  // A content identifier, specified by content provider.
  optional bytes content_id = 4;

  // The name of a registered policy to be used for this asset.
  optional string policy = 6;

  // Crypto period index, for media using key rotation.
  optional uint32 crypto_period_index = 7;

  // Optional protected context for group content. The grouped_license is a
  // serialized SignedMessage.
  optional bytes grouped_license = 8;

  // Protection scheme identifying the encryption algorithm. Represented as one
  // of the following 4CC values: 'cenc' (AES-CTR), 'cbc1' (AES-CBC),
  // 'cens' (AES-CTR subsample), 'cbcs' (AES-CBC subsample).
  optional ProtectionScheme protection_scheme = 9;
}

// Derived from WidevinePsshData. The JSON format of this proto is used in
// Widevine HLS DRM signaling v1.
// We cannot build JSON from WidevinePsshData as |key_id| is required to be in
// hex format, while |bytes| type is translated to base64 by JSON formatter, so
// we have to use |string| type and do hex conversion in the code.
message WidevineHeader {
  repeated string key_ids = 2;

  // Content provider name.
  optional string provider = 3;

  // A content identifier, specified by content provider.
  optional bytes content_id = 4;
}