lib/rasn1.rb in rasn1-0.10.0 vs lib/rasn1.rb in rasn1-0.11.0
- old
+ new
@@ -1,37 +1,14 @@
# frozen_string_literal: true
require 'rasn1/version'
+require 'rasn1/errors'
require 'rasn1/types'
require 'rasn1/model'
# Rasn1 is a pure ruby library to parse, decode and encode ASN.1 data.
# @author Sylvain Daubert
module RASN1
- # Base error class
- class Error < StandardError; end
-
- # ASN.1 encoding/decoding error
- class ASN1Error < Error; end
-
- # ASN.1 class error
- class ClassError < Error
- # @return [String]
- def message
- "Tag class should be a symbol among: #{Types::Base::CLASSES.keys.join(', ')}"
- end
- end
-
- # Enumerated error
- class EnumeratedError < Error; end
-
- # CHOICE error: #chosen not set
- class ChoiceError < RASN1::Error
- def message
- "CHOICE #{@name}: #chosen not set"
- end
- end
-
# Parse a DER/BER string without checking a model
# @note If you want to check ASN.1 grammary, you should define a {Model}
# and use {Model#parse}.
# @note This method will never decode SEQUENCE OF or SET OF objects, as these
# ones use the same encoding as SEQUENCE and SET, respectively.