mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +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
|
hex = [domain.name_in_wire_format, flags_hex, protocol_hex, alg_hex, public_key_hex].join
|
||||||
bin = self.class.hex_to_bin(hex)
|
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
|
end
|
||||||
|
|
||||||
def public_key_hex
|
def public_key_hex
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe Dnskey do
|
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) }
|
it { should belong_to(:domain) }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue