Class: CertValidator::CrlValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/cert_validator/crl/extractor.rb,
lib/cert_validator/crl_validator.rb

Defined Under Namespace

Classes: Extractor

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cert, ca) ⇒ CrlValidator

Returns a new instance of CrlValidator.



10
11
12
13
# File 'lib/cert_validator/crl_validator.rb', line 10

def initialize(cert, ca)
  @certificate = cert
  @ca = ca
end

Instance Attribute Details

#caObject (readonly)

Returns the value of attribute ca.



5
6
7
# File 'lib/cert_validator/crl_validator.rb', line 5

def ca
  @ca
end

#certificateObject (readonly)

Returns the value of attribute certificate.



4
5
6
# File 'lib/cert_validator/crl_validator.rb', line 4

def certificate
  @certificate
end

#crlObject



44
45
46
47
48
49
50
51
# File 'lib/cert_validator/crl_validator.rb', line 44

def crl
  return @crl if defined? @crl
  
  distribution_points = extractor.distribution_points
  distribution_points.first do |dp|
    @crl = fetch dp
  end
end

#revoked_timeObject (readonly)

Returns the value of attribute revoked_time.



8
9
10
# File 'lib/cert_validator/crl_validator.rb', line 8

def revoked_time
  @revoked_time
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cert_validator/crl_validator.rb', line 15

def available?
  return true if has_crl_data?
  return false unless extractor.has_distribution_points?

  begin
    return false unless vivified_crl
  rescue OpenSSL::X509::CRLError
    return false
  end

  return true
end

#valid?Boolean

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/cert_validator/crl_validator.rb', line 28

def valid?
  return false unless available?

  begin
    return false unless vivified_crl
  rescue OpenSSL::X509::CRLError
    return false
  end

  return false unless matches_ca?
  
  return false if revoked?

  return true
end