| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Mail::DKIM::ARC::Seal; | 
| 2 | 3 |  |  | 3 |  | 21 | use strict; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 96 |  | 
| 3 | 3 |  |  | 3 |  | 15 | use warnings; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 128 |  | 
| 4 |  |  |  |  |  |  | our $VERSION = '1.20230911'; # VERSION | 
| 5 |  |  |  |  |  |  | # ABSTRACT: represents a ARC-Seal header | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | # Copyright 2017 FastMail Pty Ltd. All Rights Reserved. | 
| 8 |  |  |  |  |  |  | # Bron Gondwana | 
| 9 |  |  |  |  |  |  | # | 
| 10 |  |  |  |  |  |  | # This program is free software; you can redistribute it and/or | 
| 11 |  |  |  |  |  |  | # modify it under the same terms as Perl itself. | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 3 |  |  | 3 |  | 18 | use base 'Mail::DKIM::ARC::MessageSignature'; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 1313 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | sub new { | 
| 17 | 385 |  |  | 385 | 1 | 684 | my $class = shift; | 
| 18 | 385 |  |  |  |  | 774 | my %prms  = @_; | 
| 19 | 385 |  |  |  |  | 782 | my $self  = {}; | 
| 20 | 385 |  |  |  |  | 761 | bless $self, $class; | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 385 | 100 |  |  |  | 851 | $self->instance( $prms{'Instance'} ) if exists $prms{'Instance'}; | 
| 23 | 385 |  | 100 |  |  | 1790 | $self->algorithm( $prms{'Algorithm'} || 'rsa-sha256' ); | 
| 24 | 385 |  |  |  |  | 1535 | $self->signature( $prms{'Signature'} ); | 
| 25 | 385 | 50 |  |  |  | 1150 | $self->canonicalization( $prms{'Method'} ) if exists $prms{'Method'}; | 
| 26 | 385 |  | 100 |  |  | 1630 | $self->chain( $prms{'Chain'} || 'none' ); | 
| 27 | 385 |  |  |  |  | 1320 | $self->domain( $prms{'Domain'} ); | 
| 28 | 385 |  |  |  |  | 1503 | $self->selector( $prms{'Selector'} ); | 
| 29 |  |  |  |  |  |  | $self->timestamp( | 
| 30 | 385 | 100 |  |  |  | 1514 | defined $prms{'Timestamp'} ? $prms{'Timestamp'} : time() ); | 
| 31 | 385 | 50 |  |  |  | 879 | $self->expiration( $prms{'Expiration'} ) if defined $prms{'Expiration'}; | 
| 32 | 385 | 50 |  |  |  | 875 | $self->tags( $prms{'Tags'} ) if defined $prms{'Tags'}; | 
| 33 | 385 | 100 |  |  |  | 812 | $self->key( $prms{'Key'} )               if defined $prms{'Key'}; | 
| 34 |  |  |  |  |  |  |  | 
| 35 | 385 |  |  |  |  | 997 | return $self; | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | sub body_hash { | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | # Not defined for ARC-Seal | 
| 41 | 131 |  |  | 131 | 1 | 282 | return; | 
| 42 |  |  |  |  |  |  | } | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | sub DEFAULT_PREFIX { | 
| 45 | 442 |  |  | 442 | 0 | 1314 | return 'ARC-Seal:'; | 
| 46 |  |  |  |  |  |  | } | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | sub chain { | 
| 50 | 385 |  |  | 385 | 1 | 570 | my $self = shift; | 
| 51 | 385 | 50 |  |  |  | 728 | if (@_) { | 
| 52 | 385 |  |  |  |  | 576 | my $cv = shift; | 
| 53 |  |  |  |  |  |  | die "INVALID chain value $cv" | 
| 54 | 385 | 50 |  |  |  | 612 | unless grep { $cv eq $_ } qw(none fail pass); | 
|  | 1155 |  |  |  |  | 2382 |  | 
| 55 | 385 |  |  |  |  | 879 | $self->set_tag( 'cv', $cv ); | 
| 56 |  |  |  |  |  |  | } | 
| 57 | 385 |  |  |  |  | 939 | return $self->get_tag('cv'); | 
| 58 |  |  |  |  |  |  | } | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | sub canonicalization { | 
| 62 | 382 |  |  | 382 | 1 | 975 | return ( 'seal', 'seal' ); | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | 1; | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | __END__ |