Class: Rupert::RPM::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/rupert/rpm/signature.rb,
lib/rupert/rpm/signature/entry.rb,
lib/rupert/rpm/signature/index.rb,
lib/rupert/rpm/signature/store.rb

Defined Under Namespace

Classes: Entry, Index, Store

Constant Summary collapse

MD5_TAG =

Tag holding 128-bit MD5 checksum of header and payload

1004.freeze

Instance Method Summary collapse

Constructor Details

#initialize(index) ⇒ Signature

Creates a new signature given its components.

Parameters:



13
14
15
# File 'lib/rupert/rpm/signature.rb', line 13

def initialize(index)
  @index = index
end

Instance Method Details

#md5String

MD5 checksum contained in the RPM.

Returns:

  • (String)

    128-bit MD5 checksum of RPM’s header and payload, in raw binary form.



21
22
23
# File 'lib/rupert/rpm/signature.rb', line 21

def md5
  @index.get MD5_TAG
end

#verify_checksum(content) ⇒ Object

Verifies if stored MD5 checksum corresponds to digest calculated over given content.

Returns:

  • ‘true` if stored MD5 checksum corresponds to MD5 calculated over given content, `false` otherwise



30
31
32
# File 'lib/rupert/rpm/signature.rb', line 30

def verify_checksum(content)
  md5 == md5_checksum(content)
end