pssh_box 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/pssh_box/builder.rb +29 -11
- data/lib/pssh_box/version.rb +1 -1
- data/pssh_box.gemspec +32 -32
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9b3e35812098db35aae931bb2b14e879625b56ceb7001323f504002eb7d538d
|
4
|
+
data.tar.gz: b708d02ed8554be4d665344b03b943f9ee992cba14354c05f9f4b6d01de36163
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 886e0327377e89873769ccf15b6d8b7dded4b8e636576b426f8193ea12ff2b1197c6fb469d28931707686d743cc8ca37e271f9da677a28a62d0f75fdf2059785
|
7
|
+
data.tar.gz: 364f98a00418e93fcb02c4505490684309ffce452264fbb5ccf898ec0376d6c249dcf17be28ecded9e9566dc73c7248a038a3bf3b6c189fbf4e7305488864939
|
data/Gemfile.lock
CHANGED
data/lib/pssh_box/builder.rb
CHANGED
@@ -25,21 +25,39 @@ module PsshBox
|
|
25
25
|
|
26
26
|
def self.build_pssh_bytes(key_ids, pssh_data, pssh_version, system_id)
|
27
27
|
pssh_bytes = 'pssh'.bytes
|
28
|
-
pssh_bytes +=
|
29
|
-
pssh_bytes +=
|
28
|
+
pssh_bytes += version_bytes(pssh_version)
|
29
|
+
pssh_bytes += system_id_bytes(system_id)
|
30
30
|
if pssh_version == 1
|
31
|
-
pssh_bytes +=
|
32
|
-
key_ids.each do |key_id|
|
33
|
-
pssh_bytes += uuid_to_bytes(key_id).bytes
|
34
|
-
end
|
31
|
+
pssh_bytes += key_id_bytes(key_ids)
|
35
32
|
end
|
36
|
-
pssh_bytes +=
|
37
|
-
pssh_bytes += pssh_data
|
33
|
+
pssh_bytes += pssh_data_bytes(pssh_data)
|
38
34
|
|
39
|
-
|
40
|
-
|
35
|
+
length_prefix_bytes(pssh_bytes.length) + pssh_bytes
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.version_bytes(pssh_version)
|
39
|
+
int_to_four_bytes(pssh_version << 24).bytes
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.system_id_bytes(system_id)
|
43
|
+
uuid_to_bytes(system_id).bytes
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.key_id_bytes(key_ids)
|
47
|
+
key_id_bytes = int_to_four_bytes(key_ids.length).bytes
|
48
|
+
key_ids.each do |key_id|
|
49
|
+
key_id_bytes += uuid_to_bytes(key_id).bytes
|
50
|
+
end
|
51
|
+
key_id_bytes
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.pssh_data_bytes(pssh_data)
|
55
|
+
int_to_four_bytes(pssh_data.length).bytes + pssh_data
|
56
|
+
end
|
41
57
|
|
42
|
-
|
58
|
+
def self.length_prefix_bytes(length)
|
59
|
+
length_including_prefix = 4 + length
|
60
|
+
int_to_four_bytes(length_including_prefix).bytes
|
43
61
|
end
|
44
62
|
|
45
63
|
def self.base64_encode_bytes(pssh_bytes)
|
data/lib/pssh_box/version.rb
CHANGED
data/pssh_box.gemspec
CHANGED
@@ -1,32 +1,32 @@
|
|
1
|
-
lib = File.expand_path('lib', __dir__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require 'pssh_box/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = 'pssh_box'
|
7
|
-
spec.version = PsshBox::VERSION
|
8
|
-
spec.authors = ['Catalin Ursachi']
|
9
|
-
spec.email = ['catalin.ursachi@softwire.com']
|
10
|
-
|
11
|
-
spec.summary = 'A builder for PSSH boxes used in content encryption, as per the specification at'\
|
12
|
-
' https://w3c.github.io/encrypted-media/format-registry/initdata/cenc.html.'
|
13
|
-
spec.homepage = 'https://github.com/catalin-ursachi/pssh_box'
|
14
|
-
spec.license = 'MIT'
|
15
|
-
|
16
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
-
|
18
|
-
# Specify which files should be added to the gem when it is released.
|
19
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
21
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
-
end
|
23
|
-
spec.bindir = 'exe'
|
24
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
-
spec.require_paths = ['lib']
|
26
|
-
|
27
|
-
spec.add_development_dependency 'bundler', '~> 2.0'
|
28
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
29
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
-
|
31
|
-
spec.add_dependency 'ruby-uuid', '~> 0.0.1'
|
32
|
-
end
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'pssh_box/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'pssh_box'
|
7
|
+
spec.version = PsshBox::VERSION
|
8
|
+
spec.authors = ['Catalin Ursachi']
|
9
|
+
spec.email = ['catalin.ursachi@softwire.com']
|
10
|
+
|
11
|
+
spec.summary = 'A builder for PSSH boxes used in content encryption, as per the specification at'\
|
12
|
+
' https://w3c.github.io/encrypted-media/format-registry/initdata/cenc.html.'
|
13
|
+
spec.homepage = 'https://github.com/catalin-ursachi/pssh_box'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
+
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
spec.bindir = 'exe'
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
|
31
|
+
spec.add_dependency 'ruby-uuid', '~> 0.0.1'
|
32
|
+
end
|