Class: Pliney::AppleCodeSignature::Requirement

Inherits:
Blob
  • Object
show all
Defined in:
lib/pliney/apple_code_signature.rb

Overview

An individual code requirement This is actlually a small compiled expression. csreq(1) can be used to decompile them

Constant Summary collapse

SYSTEM_HAS_CSREQ =
system("which csreq > /dev/null")

Instance Attribute Summary collapse

Attributes inherited from Blob

#input, #magic, #size

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Blob

#initialize

Constructor Details

This class inherits a constructor from Pliney::AppleCodeSignature::Blob

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



173
174
175
# File 'lib/pliney/apple_code_signature.rb', line 173

def data
  @data
end

#decompiledObject (readonly)

Returns the value of attribute decompiled.



173
174
175
# File 'lib/pliney/apple_code_signature.rb', line 173

def decompiled
  @decompiled
end

Class Method Details

.decompile(data) ⇒ Object



181
182
183
184
185
186
187
188
# File 'lib/pliney/apple_code_signature.rb', line 181

def self.decompile(data)
    return nil unless SYSTEM_HAS_CSREQ
    csreq=IO.popen("csreq -r- -t", "r+")
    csreq.write(data)
    decompiled = csreq.read()
    csreq.close()
    return decompiled
end

Instance Method Details

#parseObject



174
175
176
177
178
179
# File 'lib/pliney/apple_code_signature.rb', line 174

def parse
    super() do
        @data=rest()
        @decompiled = self.class.decompile([@magic.value, @size, @data].pack("NNA*"))
    end
end