Module: R509::Cert::Extensions
- Defined in:
- lib/r509/cert/extensions.rb
Overview
module to contain extension classes for R509::Cert
Defined Under Namespace
Classes: AuthorityInfoAccess, AuthorityKeyIdentifier, BasicConstraints, CrlDistributionPoints, ExtendedKeyUsage, KeyUsage, SubjectAlternativeName, SubjectKeyIdentifier
Constant Summary
Class Method Summary (collapse)
-
+ (Object) get_unknown_extensions(extensions)
Given a list of OpenSSL::X509::Extension objects, returns those without an R509 implementation.
-
+ (Object) wrap_openssl_extensions(extensions)
Takes OpenSSL::X509::Extension objects and wraps each in the appropriate R509::Cert::Extensions object, and returns them in a hash.
Class Method Details
+ (Object) get_unknown_extensions(extensions)
Given a list of OpenSSL::X509::Extension objects, returns those without an R509 implementation.
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/r509/cert/extensions.rb', line 300 def self.get_unknown_extensions( extensions ) unknown_extensions = [] extensions.each do |openssl_extension| match_found = false R509_EXTENSION_CLASSES.each do |r509_class| if ( r509_class::OID.downcase == openssl_extension.oid.downcase ) match_found = true break end end # if we make it this far (without breaking), we didn't match unknown_extensions << openssl_extension unless match_found end return unknown_extensions end |
+ (Object) wrap_openssl_extensions(extensions)
Takes OpenSSL::X509::Extension objects and wraps each in the appropriate R509::Cert::Extensions object, and returns them in a hash. The hash is keyed with the R509 extension class. Extensions without an R509 implementation are ignored (see #get_unknown_extensions).
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/r509/cert/extensions.rb', line 280 def self.wrap_openssl_extensions( extensions ) r509_extensions = {} extensions.each do |openssl_extension| R509_EXTENSION_CLASSES.each do |r509_class| if ( r509_class::OID.downcase == openssl_extension.oid.downcase ) if r509_extensions.has_key?(r509_class) raise ArgumentError.new("Only one extension object allowed per OID") end r509_extensions[r509_class] = r509_class.new( openssl_extension ) break end end end return r509_extensions end |