Dnskey generation settings

This commit is contained in:
Martin Lensment 2014-10-14 12:07:21 +03:00
parent da6b115f6f
commit f90bb8f26e
2 changed files with 15 additions and 2 deletions

View file

@ -61,7 +61,14 @@ class Dnskey < ActiveRecord::Base
hex = [domain.name_in_wire_format, flags_hex, protocol_hex, alg_hex, public_key_hex].join
bin = self.class.hex_to_bin(hex)
self.ds_digest = Digest::SHA256.hexdigest(bin).upcase
sg = SettingGroup.dnskeys.setting(Setting::DS_ALGORITHM).value
if sg == '1'
self.ds_digest = Digest::SHA1.hexdigest(bin).upcase
elsif sg == '2'
self.ds_digest = Digest::SHA256.hexdigest(bin).upcase
end
end
def public_key_hex