lib/r509/cert/extensions/inhibit_any_policy.rb in r509-0.10.0 vs lib/r509/cert/extensions/inhibit_any_policy.rb in r509-1.0
- old
+ new
@@ -29,11 +29,11 @@
# This method takes a hash or an existing Extension object to parse
#
# @option arg :value [Integer]
# @option arg :critical [Boolean] (true)
def initialize(arg)
- if not R509::Cert::Extensions.is_extension?(arg)
+ unless R509::Cert::Extensions.is_extension?(arg)
arg = build_extension(arg)
end
super(arg)
parse_extension
@@ -48,22 +48,23 @@
def to_yaml
self.to_h.to_yaml
end
private
+
def parse_extension
# id-ce-inhibitAnyPolicy OBJECT IDENTIFIER ::= { id-ce 54 }
# InhibitAnyPolicy ::= SkipCerts
# SkipCerts ::= INTEGER (0..MAX)
@value = R509::ASN1.get_extension_payload(self).to_i # returns a non-negative integer
end
def build_extension(arg)
- validate_non_negative_integer("Inhibit any policy",arg[:value])
+ validate_non_negative_integer("Inhibit any policy", arg[:value])
ef = OpenSSL::X509::ExtensionFactory.new
critical = R509::Cert::Extensions.calculate_critical(arg[:critical], true)
# must be set critical per RFC 5280
- return ef.create_extension("inhibitAnyPolicy",arg[:value].to_s,critical)
+ ef.create_extension("inhibitAnyPolicy", arg[:value].to_s, critical)
end
end
end
end
end