class SSLyze::X509::Extensions::CertificatePolicies
Represents the `certificatePolicies` X509v3 extension.
@since 1.0.0
Public Instance Methods
each(&block)
click to toggle source
Enumerates over every certificate policy in the extension.
@yield [policy]
The given block will be passed each parsed policy.
@yieldparam [Policy] policy
A parsed certificate policy.
@return [Enumerator]
If no block is given, an Enumerator will be returned.
# File lib/sslyze/x509/extensions/certificate_policies.rb, line 101 def each(&block) policies.each(&block) end
length()
click to toggle source
The number of certificate policies.
@return [Integer]
# File lib/sslyze/x509/extensions/certificate_policies.rb, line 85 def length policies.length end
policies()
click to toggle source
Parses the individual policies listed in the extension's value.
@return [Array<Policy>]
# File lib/sslyze/x509/extensions/certificate_policies.rb, line 62 def policies # XXX: ugly multiline regexp to parse the certificate policies and # their qualifiers. @policies ||= value.scan(/^Policy: [^\n]+\n(?: [^:]+: [^\n]+\n)*/m).map do |text| policy = text.match(/^Policy: ([^\n]+)/)[1] cps = if (match = text.match(/^ CPS: ([^\n]+)/m)) URI.parse(match[1]) end user_notice = if (match = text.match(/^ User Notice: ([^\n]+)/m)) match[1] end Policy.new(policy, cps: cps, user_notice: user_notice) end end