mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Dnskey generation settings
This commit is contained in:
parent
da6b115f6f
commit
f90bb8f26e
2 changed files with 15 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Dnskey do
|
||||
before(:each) { Fabricate(:domain_validation_setting_group) }
|
||||
before(:each) do
|
||||
Fabricate(:domain_validation_setting_group)
|
||||
|
||||
Fabricate(:setting_group, code: 'dnskeys', settings: [
|
||||
Fabricate(:setting, code: Setting::DS_ALGORITHM, value: 2)
|
||||
])
|
||||
end
|
||||
|
||||
it { should belong_to(:domain) }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue