dkim 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -65,7 +65,7 @@ The defaults should fit most users needs; however, certain use cases will need t
65
65
 
66
66
  For example, for sending mesages through amazon SES, certain headers should not be signed
67
67
 
68
- Dkim::signable_headers = Dkim::DefaultHeaders - %w{Message-Id Resent-Message-ID Date Return-Path Bounces-To}
68
+ Dkim::signable_headers = Dkim::DefaultHeaders - %w{Message-ID Resent-Message-ID Date Return-Path Bounces-To}
69
69
 
70
70
  rfc4871 states that signers SHOULD sign using rsa-sha256. For this reason, dkim will *not* use rsa-sha1 as a fallback if the openssl library does not support sha256.
71
71
  If you wish to override this behaviour and use whichever algorithm is available you can use this snippet (**not recommended**).
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- if ARGV.length != 2 && ARGV.length != 3
3
+ if ARGV.length != 3 && ARGV.length != 4
4
4
  puts "Usage: dkimsign.rb DOMAIN SELECTOR KEYFILE [MAILFILE]"
5
5
  exit 0
6
6
  end
@@ -1,7 +1,9 @@
1
+
1
2
  module Dkim
2
3
  class Interceptor
3
4
  def self.delivering_email(message)
4
- message['DKIM-Signature'] = SignedMail.new(message.encoded).dkim_header.value
5
+ require 'mail/dkim_field'
6
+ message.header.fields << Mail::DkimField.new(SignedMail.new(message.encoded).dkim_header.value)
5
7
  message
6
8
  end
7
9
  end
@@ -1,3 +1,3 @@
1
1
  module Dkim
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,25 @@
1
+
2
+ require 'mail'
3
+ require 'mail/fields'
4
+
5
+ module Mail
6
+ class DkimField < StructuredField
7
+ FIELD_NAME = 'dkim-signature'
8
+ CAPITALIZED_FIELD = 'DKIM-Signature'
9
+
10
+ def initialize(value = nil, charset = 'utf-8')
11
+ self.charset = charset
12
+ super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, value), charset)
13
+ self
14
+ end
15
+
16
+ def encoded
17
+ "#{name}:#{value}\n"
18
+ end
19
+
20
+ def decoded
21
+ "#{name}:#{value}\n"
22
+ end
23
+ end
24
+ end
25
+
metadata CHANGED
@@ -1,33 +1,24 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dkim
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 3
10
- version: 0.0.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - John Hawthorn
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-07-26 00:00:00 Z
12
+ date: 2011-12-10 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description: gem for adding DKIM signatures to email messages
22
- email:
15
+ email:
23
16
  - john.hawthorn@gmail.com
24
- executables:
17
+ executables:
25
18
  - dkimsign.rb
26
19
  extensions: []
27
-
28
20
  extra_rdoc_files: []
29
-
30
- files:
21
+ files:
31
22
  - .gitignore
32
23
  - CHANGELOG.md
33
24
  - Gemfile
@@ -44,41 +35,33 @@ files:
44
35
  - lib/dkim/interceptor.rb
45
36
  - lib/dkim/signed_mail.rb
46
37
  - lib/dkim/version.rb
38
+ - lib/mail/dkim_field.rb
47
39
  - test/canonicalization_test.rb
48
40
  - test/test_helper.rb
49
41
  homepage: https://github.com/jhawthorn/dkim
50
42
  licenses: []
51
-
52
43
  post_install_message:
53
44
  rdoc_options: []
54
-
55
- require_paths:
45
+ require_paths:
56
46
  - lib
57
- required_ruby_version: !ruby/object:Gem::Requirement
47
+ required_ruby_version: !ruby/object:Gem::Requirement
58
48
  none: false
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- hash: 3
63
- segments:
64
- - 0
65
- version: "0"
66
- required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
54
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
75
59
  requirements: []
76
-
77
60
  rubyforge_project: dkim
78
- rubygems_version: 1.8.5
61
+ rubygems_version: 1.8.10
79
62
  signing_key:
80
63
  specification_version: 3
81
64
  summary: DKIM library in ruby
82
- test_files:
65
+ test_files:
83
66
  - test/canonicalization_test.rb
84
67
  - test/test_helper.rb