Skip to content

Instantly share code, notes, and snippets.

@mat813
Created June 18, 2011 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mat813/1033011 to your computer and use it in GitHub Desktop.
Save mat813/1033011 to your computer and use it in GitHub Desktop.
DS Submit command to add SHA1 and SHA256 DS to the lot
#!/usr/bin/env ruby
require 'rubygems'
require 'dnsruby'
module Dnsruby
class RR
class DS
def rdata_to_string
if (@key_tag != nil)
return "#{@key_tag.to_i} #{@algorithm.code} #{@digest_type.code} #{@digest.upcase}"
else
return ""
end
end
end
class DNSKEY
def rdata_to_string #:nodoc: all
if (@flags!=nil)
return "#{@flags} #{@protocol} #{@algorithm.code} ( #{[@key.to_s].pack("m*").gsub("\n", "")} ) ; key_tag=#{key_tag}"
else
return ""
end
end
end
end
end
while line = STDIN.gets
key = Dnsruby::RR::DNSKEY.new_from_string(line)
puts "Key : #{key.key_tag}"
puts key
puts Dnsruby::RR::DS.from_key(key, 1)
puts Dnsruby::RR::DS.from_key(key, 2)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment