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, CertificatePolicies, ExtendedKeyUsage, InhibitAnyPolicy, KeyUsage, NameConstraints, OCSPNoCheck, PolicyConstraints, 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.
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 |
# File 'lib/r509/cert/extensions.rb', line 657 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).
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 |
# File 'lib/r509/cert/extensions.rb', line 637 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 |