Module: R509::Cert::Extensions
- Defined in:
- lib/r509/cert/extensions.rb
Defined Under Namespace
Classes: AuthorityInfoAccess, AuthorityKeyIdentifier, BasicConstraints, CrlDistributionPoints, ExtendedKeyUsage, KeyUsage, SubjectAlternativeName, SubjectKeyIdentifier
Constant Summary
- DNS_REGEX =
Regexes for OpenSSL's parsed values
/DNS:([^,\n]+)/
- IP_ADDRESS_REGEX =
/IP:([^,\n]+)/
- URI_REGEX =
/URI:([^,\n]+)/
- R509_EXTENSION_CLASSES =
Set.new
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.
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/r509/cert/extensions.rb', line 290 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).
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/r509/cert/extensions.rb', line 270 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 |