Sha256: 0a80c06d5dd60e96e67808c1ec87f24eaf59ca30ada825ea4871b282d0f0f5e2

Contents?: true

Size: 1.83 KB

Versions: 1

Compression:

Stored size: 1.83 KB

Contents

class CertValidator
  class Error < StandardError
  end

  class OcspNotAvailableError < Error
    def initialize
      super "OCSP functionality isn't available in this version of Ruby."
    end
  end

  class RecursiveExtractError < Error
    def initialize
      super "Tried to extract a value from a recursive structure. Please file a bug!"
    end
  end

  class CrlFetchError < Error
    def initialize
      super "Couldn't fetch CRL."
    end
  end

  module OcspFailures
    class OcspFailure < Error
    end

    class FetchError < OcspFailure
      def initialize
        super "Couldn't fetch OCSP."
      end
    end

    class NonzeroStatus < OcspFailure
      def initialize(status)
        super "OCSP status was #{status}, expected 0"
      end
    end

    class ResponseMismatch < OcspFailure
      def initialize
        super "OCSP response did not match certificate issuer"
      end
    end

    class MissingStatus < OcspFailure
      def initialize
        super "OCSP response was missing status section"
      end
    end

    class UnacceptableNonce < OcspFailure
      def initialize
        super "OCSP response had unacceptable result from nonce check"
      end
    end

    class SerialMismatch < OcspFailure
      def initialize(got, expected)
        super "OCSP response serial was #{got.inspect}, expected #{expected.inspect}"
      end
    end

    class NotValidNow < OcspFailure
      def initialize(validity_range)
        super "OCSP response only valid from #{validity_range.begin} to #{validity_range.end}, currently #{Time.now}"
      end
    end

    class Revoked < OcspFailure
      def initialize
        super "OCSP response indicates cert was revoked"
      end
    end

    class UnexpectedStatus < OcspFailure
      def initialize(got)
        super "OCSP response was #{got.inspect}, expected 0"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cert_validator-0.0.1 lib/cert_validator/errors.rb