def extract_signed_data(digsig)
            # Computes the boundaries of the Contents field.
            start_sig = digsig[:Contents].file_offset

            stream = StringScanner.new(self.original_data)
            stream.pos = digsig[:Contents].file_offset
            Object.typeof(stream).parse(stream)
            end_sig = stream.pos
            stream.terminate

            r1, r2 = digsig.ranges
            if r1.begin != 0 or
                r2.end != self.original_data.size or
                r1.end != start_sig or
                r2.begin != end_sig

                raise SignatureError, "Invalid signature byte range"
            end

            self.original_data[r1] + self.original_data[r2]
        end
def extract_signed_data(digsig)
            # Computes the boundaries of the Contents field.
            start_sig = digsig[:Contents].file_offset

            stream = StringScanner.new(self.original_data)
            stream.pos = digsig[:Contents].file_offset
            Object.typeof(stream).parse(stream)
            end_sig = stream.pos
            stream.terminate

            r1, r2 = digsig.ranges
            if r1.begin != 0 or
                r2.end != self.original_data.size or
                r1.end != start_sig or
                r2.begin != end_sig

                raise SignatureError, "Invalid signature byte range"
            end

            self.original_data[r1] + self.original_data[r2]
        end
Verifies the ByteRange field of a digital signature and returned the signed data.