Created
June 18, 2011 11:20
-
-
Save mat813/1033011 to your computer and use it in GitHub Desktop.
DS Submit command to add SHA1 and SHA256 DS to the lot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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