attributes.rb 697 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Certificate::X509::SMIME::Attributes
  3. def fetch_email_addresses
  4. subject_alt_name = extensions_as_hash['subjectAltName']
  5. return [] if subject_alt_name.blank?
  6. subject_alt_name.each_with_object([]) do |entry, result|
  7. identifier, email_address = entry.split(':').map(&:downcase)
  8. next if identifier.exclude?('email') && identifier.exclude?('rfc822')
  9. next if !EmailAddressValidation.new(email_address).valid?
  10. result.push(email_address)
  11. end
  12. end
  13. def determine_uid
  14. return public_key.n.to_s(16) if rsa?
  15. OpenSSL::Digest.new('SHA1', public_key.to_der).to_s
  16. end
  17. end