Module: MailReport::TlsRpt
- Defined in:
- lib/mailreport/tls_rpt.rb
Overview
RFC 8460.
Defined Under Namespace
Classes: Failure, Policy, Report
Constant Summary collapse
- REPORT_NAME =
/\.json\z/i
Class Method Summary collapse
Class Method Details
.parse(bytes) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mailreport/tls_rpt.rb', line 38 def parse(bytes) json = Archive.open(bytes, name: REPORT_NAME)&.force_encoding(Encoding::UTF_8) # A report is JSON, and JSON is UTF-8 (RFC 8460 §3, RFC 8259 §8.1). document = JSON.parse(json) if json&.valid_encoding? report_from(document) if document.is_a?(Hash) rescue JSON::ParserError nil end |