~ar-python-hackers/authentication-results-python/trunk

« back to all changes in this revision

Viewing changes to authres/core.py

  • Committer: Gene Shuman
  • Date: 2017-08-01 19:26:43 UTC
  • mto: This revision was merged to the branch mainline in revision 107.
  • Revision ID: gene@valimail.com-20170801192643-qfv7c8w2qyag983b
Updated AR Stamping for ARC

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# coding: utf-8
2
2
 
3
3
# Copyright © 2011-2013 Julian Mehnle <julian@mehnle.net>,
4
 
# Copyright © 2011-2018 Scott Kitterman <scott@kitterman.com>
 
4
# Copyright © 2011-2013 Scott Kitterman <scott@kitterman.com>
5
5
#
6
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
7
# you may not use this file except in compliance with the License.
241
241
        reason               = None,  reason_comment               = None,
242
242
        properties = None,
243
243
        header_d             = None,  header_d_comment             = None,
244
 
        header_i             = None,  header_i_comment             = None,
245
 
        header_a             = None,  header_a_comment             = None,
246
 
        header_s             = None,  header_s_comment             = None
 
244
        header_i             = None,  header_i_comment             = None
247
245
    ):
248
246
        AuthenticationResult.__init__(self, self.METHOD, version,
249
247
            result, result_comment, reason, reason_comment, properties)
251
249
        if header_d_comment:             self.header_d_comment             = header_d_comment
252
250
        if header_i:                     self.header_i                     = header_i
253
251
        if header_i_comment:             self.header_i_comment             = header_i_comment
254
 
        if header_a:                     self.header_a                     = header_a
255
 
        if header_a_comment:             self.header_a_comment             = header_a_comment
256
 
        if header_s:                     self.header_s                     = header_s
257
 
        if header_s_comment:             self.header_s_comment             = header_s_comment
258
252
 
259
253
    header_d,             header_d_comment             = make_result_class_properties('header', 'd')
260
254
    header_i,             header_i_comment             = make_result_class_properties('header', 'i')
261
 
    header_a,             header_a_comment             = make_result_class_properties('header', 'a')
262
 
    header_s,             header_s_comment             = make_result_class_properties('header', 's')
263
255
 
264
256
    def match_signature(self, signature_d):
265
257
        """Match authentication result against a DKIM signature by ``header.d``."""
266
258
 
267
259
        return self.header_d == signature_d
268
260
 
269
 
    def match_signature_algorithm(self, signature_d, signature_a):
270
 
        """Match authentication result against a DKIM signature by ``header.d`` and ``header.a``."""
271
 
 
272
 
        return self.header_d == signature_d and self.header_a == signature_a
273
 
 
274
261
class DomainKeysAuthenticationResult(AuthenticationResult):
275
262
    "DomainKeys result clause of an ``Authentication-Results`` header"
276
263