Class: R509::Cert::Validator::CrlValidator

Inherits:
BasicValidator show all
Defined in:
lib/r509/cert/validator/crl_validator.rb

Instance Method Summary collapse

Methods inherited from BasicValidator

#initialize

Constructor Details

This class inherits a constructor from R509::Cert::Validator::BasicValidator

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


5
6
7
8
9
# File 'lib/r509/cert/validator/crl_validator.rb', line 5

def available?
  return false unless cdp
  return false if uris.empty?
  return true
end

#validate!Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/r509/cert/validator/crl_validator.rb', line 11

def validate!
  unless available?
    raise Error.new "Tried to validate CRL but cert has no CRL data"
  end

  body = R509::CRL::SignedList.new(get(uris.first))

  unless body.verify @issuer.public_key
    raise CrlError.new "CRL did not match certificate"
  end

  if body.revoked? @cert.serial
    raise CrlError.new "CRL listed certificate as revoked"
  end

  return true
end