Class: R509::Cert::Extensions::BasicConstraints
- Inherits:
-
OpenSSL::X509::Extension
- Object
- OpenSSL::X509::Extension
- R509::Cert::Extensions::BasicConstraints
- Defined in:
- lib/r509/cert/extensions.rb
Overview
Implements the BasicConstraints certificate extension, with methods to provide access to the components and meaning of the extension's contents.
Constant Summary
- OID =
friendly name for BasicConstraints OID
"basicConstraints"
Instance Attribute Summary (collapse)
-
- (Object) path_length
readonly
Returns the value of attribute path_length.
Instance Method Summary (collapse)
-
- (Boolean) allows_sub_ca?
Returns true if the path length allows this certificate to be used to sign CA certificates.
-
- (BasicConstraints) initialize(*args)
constructor
See OpenSSL::X509::Extension#initialize.
- - (Boolean) is_ca?
Constructor Details
- (BasicConstraints) initialize(*args)
See OpenSSL::X509::Extension#initialize
36 37 38 39 40 41 42 |
# File 'lib/r509/cert/extensions.rb', line 36 def initialize(*args) super(*args) @is_ca = ! ( self.value =~ /CA:TRUE/ ).nil? pathlen_match = self.value.match( /pathlen:(\d+)/ ) @path_length = pathlen_match[1].to_i unless pathlen_match.nil? end |
Instance Attribute Details
- (Object) path_length (readonly)
Returns the value of attribute path_length
33 34 35 |
# File 'lib/r509/cert/extensions.rb', line 33 def path_length @path_length end |
Instance Method Details
- (Boolean) allows_sub_ca?
Returns true if the path length allows this certificate to be used to sign CA certificates.
50 51 52 53 |
# File 'lib/r509/cert/extensions.rb', line 50 def allows_sub_ca?() return false if @path_length.nil? return @path_length > 0 end |
- (Boolean) is_ca?
44 45 46 |
# File 'lib/r509/cert/extensions.rb', line 44 def is_ca?() return @is_ca == true end |