
$LOAD_PATH << File.expand_path('../../lib', __FILE__)

require 'minitest/autorun'
require 'dkim'

class String
  # Parse the format used in RFC 6376
  #
  # In the following examples, actual whitespace is used only for
  # clarity.  The actual input and output text is designated using
  # bracketed descriptors: "<SP>" for a space character, "<HTAB>" for a
  # tab character, and "<CRLF>" for a carriage-return/line-feed sequence.
  # For example, "X <SP> Y" and "X<SP>Y" represent the same three
  # characters.
  def rfc_format
    str = self.dup
    str.gsub!(/\s/,'')
    str.gsub!(/<SP>/i,' ')
    str.gsub!(/<CR>/i,"\r")
    str.gsub!(/<LF>/i,"\n")
    str.gsub!(/<CRLF>/i,"\r\n")
    str.gsub!(/<HTAB>/i,"\t")
    str
  end
end

# examples used in RFC 6376
EXAMPLEEMAIL = %{
From: Joe SixPack <IIVyTowbcT@www.brandonchecketts.com>
To: Suzie Q <suzie@shopping.example.net>
Subject: Is dinner ready?
Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT)
Message-ID: <20030712040037.46341.5F8J@football.example.com>

Hi.

We lost the game. Are you hungry yet?

Joe.}.gsub(/\A\n/,'')

Dkim::domain = 'example.com'
Dkim::selector = 'brisbane'
Dkim::private_key = %{
-----BEGIN RSA PRIVATE KEY-----
MIICXwIBAAKBgQDwIRP/UC3SBsEmGqZ9ZJW3/DkMoGeLnQg1fWn7/zYtIxN2SnFC
jxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v/RtdC2UzJ1lWT947qR+Rcac2gb
to/NMqJ0fzfVjH4OuKhitdY9tf6mcwGjaNBcWToIMmPSPDdQPNUYckcQ2QIDAQAB
AoGBALmn+XwWk7akvkUlqb+dOxyLB9i5VBVfje89Teolwc9YJT36BGN/l4e0l6QX
/1//6DWUTB3KI6wFcm7TWJcxbS0tcKZX7FsJvUz1SbQnkS54DJck1EZO/BLa5ckJ
gAYIaqlA9C0ZwM6i58lLlPadX/rtHb7pWzeNcZHjKrjM461ZAkEA+itss2nRlmyO
n1/5yDyCluST4dQfO8kAB3toSEVc7DeFeDhnC1mZdjASZNvdHS4gbLIA1hUGEF9m
3hKsGUMMPwJBAPW5v/U+AWTADFCS22t72NUurgzeAbzb1HWMqO4y4+9Hpjk5wvL/
eVYizyuce3/fGke7aRYw/ADKygMJdW8H/OcCQQDz5OQb4j2QDpPZc0Nc4QlbvMsj
7p7otWRO5xRa6SzXqqV3+F0VpqvDmshEBkoCydaYwc2o6WQ5EBmExeV8124XAkEA
qZzGsIxVP+sEVRWZmW6KNFSdVUpk3qzK0Tz/WjQMe5z0UunY9Ax9/4PVhp/j61bf
eAYXunajbBSOLlx4D+TunwJBANkPI5S9iylsbLs6NkaMHV6k5ioHBBmgCak95JGX
GMot/L2x0IYyMLAz6oLWh2hm7zwtb0CgOrPo1ke44hFYnfc=
-----END RSA PRIVATE KEY-----
}

