Class: Resolv::DNS::Resource::CAA

Inherits:
Resource
  • Object
show all
Defined in:
lib/resolv.rb

Overview

CAA resource record defined in RFC 8659

These records identify certificate authority allowed to issue certificates for the given domain.

Constant Summary collapse

TypeValue =
257

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flags, tag, value) ⇒ CAA

Creates a new CAA for flags, tag and value.



2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
# File 'lib/resolv.rb', line 2780

def initialize(flags, tag, value)
  unless (0..255) === flags
    raise ArgumentError.new('flags must be an Integer between 0 and 255')
  end
  unless (1..15) === tag.bytesize
    raise ArgumentError.new('length of tag must be between 1 and 15')
  end

  @flags = flags
  @tag = tag
  @value = value
end

Instance Attribute Details

#flags ⇒ Object (readonly)

Flags for this property:

  • Bit 0 : 0 = not critical, 1 = critical


2797
2798
2799
# File 'lib/resolv.rb', line 2797

def flags
  @flags
end

#tag ⇒ Object (readonly)

Property tag ("issue", "issuewild", "iodef"...).



2802
2803
2804
# File 'lib/resolv.rb', line 2802

def tag
  @tag
end

#value ⇒ Object (readonly)

Property value.



2807
2808
2809
# File 'lib/resolv.rb', line 2807

def value
  @value
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:



2822
2823
2824
2825
2826
2827
# File 'lib/resolv.rb', line 2822

def self.decode_rdata(msg) # :nodoc:
  flags, = msg.get_unpack('C')
  tag = msg.get_string
  value = msg.get_bytes
  self.new flags, tag, value
end

Instance Method Details

#critical? ⇒ Boolean

Whether the critical flag is set on this property.

Returns:

  • (Boolean)


2812
2813
2814
# File 'lib/resolv.rb', line 2812

def critical?
  flags & 0x80 != 0
end

#encode_rdata(msg) ⇒ Object

:nodoc:



2816
2817
2818
2819
2820
# File 'lib/resolv.rb', line 2816

def encode_rdata(msg) # :nodoc:
  msg.put_pack('C', @flags)
  msg.put_string(@tag)
  msg.put_bytes(@value)
end