# File lib/Dnsruby/resource/HIP.rb, line 47 47: def from_hash(hash) 48: @rsvs=[] 49: @hit_length = hash[:hit_length] 50: @pk_algorithm = hash[:pk_algorithm] 51: @pk_length = hash[:pk_length] 52: @hit = hash[:hit] 53: @public_key = hash[:public_key] 54: if (hash[:rsvs]) 55: hash[:rsvs].each {|rsv| 56: @rsvs.push(Name.create(rsv)) 57: } 58: end 59: end
# File lib/Dnsruby/resource/HIP.rb, line 84 84: def from_string(input) 85: @rsvs=[] 86: if (input.length > 0) 87: split = input.split(" ") 88: 89: @pk_algorithm = split[0].to_i 90: @hit = hit_from_string(split[1]) 91: @hit_length = @hit.length 92: @public_key = public_key_from_string(split[2]) 93: @pk_length = @public_key.length 94: 95: # Now load in any RSVs there may be 96: count = 3 97: while (split[count]) 98: @rsvs.push(Name.create(split[count])) 99: count += 1 100: end 101: 102: end 103: end
# File lib/Dnsruby/resource/HIP.rb, line 66 66: def hit_from_string(hit_text) 67: # Decode the hex value 68: hit_text.gsub!(/\n/, "") 69: hit_text.gsub!(/ /, "") 70: return hit_text.unpack("H*")[0] 71: end
HIT field - stored in binary : client methods should handle base16(hex) encoding
# File lib/Dnsruby/resource/HIP.rb, line 62 62: def hit_string 63: # Return hex value 64: [@hit.to_s].pack("H*").gsub("\n", "") 65: end
# File lib/Dnsruby/resource/HIP.rb, line 78 78: def public_key_from_string(key_text) 79: key_text.gsub!(/\n/, "") 80: key_text.gsub!(/ /, "") 81: return key_text.unpack("m*")[0] 82: end
Public Key field - presentation format is base64 - public_key methods reused from IPSECKEY
# File lib/Dnsruby/resource/HIP.rb, line 74 74: def public_key_string 75: [@public_key.to_s].pack("m*").gsub("\n", "") 76: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.