Compare commits
9 Commits
5b9aaba817
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f2a9e17d4 | |||
| 015d4bacfa | |||
| 9503fd60b0 | |||
| 003a405242 | |||
| f5ae75cd9a | |||
| a4fdd73ecb | |||
| bb1d5699af | |||
| 1f8aea2173 | |||
| 369cab0047 |
@@ -0,0 +1,85 @@
|
|||||||
|
Welcome to this plaintext file.
|
||||||
|
This file is strictly licensed as CC0, public domain –- only this file though.
|
||||||
|
I'm Uea-angkun "Diskette" Khunpradith (diskette@unix.in.th), the author of this file.
|
||||||
|
This file exists because I'm a self-taught ametuer programmer and I wanted to keep notes of the things that this software does. And I do not want to use generative AI, as it does not help or teach me in anyway. It's just a cheatsheet of doing something.
|
||||||
|
This is what Stallman would've wanted... a free software for education....
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
[IDK] : Will return later and figure out how it works
|
||||||
|
[NSURE]: Not sure, under the assumption of guessing how it works
|
||||||
|
[IK] : The author seemed to have an understanding of this
|
||||||
|
[$TITLE] : the title of the file
|
||||||
|
[WONDR] : Wonder if I can improve this...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Personal notes:
|
||||||
|
Python's __main__ and __init__
|
||||||
|
As far as I know, __init__ is the initialization script, just like Unix and alike's /etc/init.rc script. It's required to make it so that it's a package.
|
||||||
|
The double underscores is for signifying that it's a global variable.
|
||||||
|
|
||||||
|
b before string, for example b'relaxed' is a way to say that it's a binary string
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-----START DKIM DIRECTORY-----
|
||||||
|
[__init__]
|
||||||
|
__init__ in this case, import the libraries required for dkim magic. And tests authres, the dkim magic library, and nacl (sodium) library for ed25519 signing.
|
||||||
|
|
||||||
|
dkim.canonicalization is quite literally, ../dkim/canonicalization/
|
||||||
|
|
||||||
|
[IDK]
|
||||||
|
There's a variable named "sig" in which I don't know
|
||||||
|
|
||||||
|
|
||||||
|
[arcsign.py]
|
||||||
|
This is for ARC... we don't use that YET
|
||||||
|
|
||||||
|
[arcverify.py]
|
||||||
|
Same goes for that too
|
||||||
|
|
||||||
|
|
||||||
|
[asn1.py]
|
||||||
|
cryptography interface language stuff
|
||||||
|
|
||||||
|
|
||||||
|
[asyncsupport.py]
|
||||||
|
asynchronous support. quite literally again..
|
||||||
|
|
||||||
|
|
||||||
|
[canonicalization.py]
|
||||||
|
Canonicalization, in computer science is a process for converting data that has more than one possible representation into a standard "canonical" form --- thanks wikipedia, CC BY-SA 4.0
|
||||||
|
|
||||||
|
imports regular expression module
|
||||||
|
|
||||||
|
unused (potential future code) exception
|
||||||
|
|
||||||
|
lots of regular expression codes..
|
||||||
|
|
||||||
|
[WONDR]
|
||||||
|
I wonder if I can fit my U-label convertor here...
|
||||||
|
|
||||||
|
[crypto.py]
|
||||||
|
quite literally cryptography stuff with private key and public key
|
||||||
|
|
||||||
|
|
||||||
|
[dkimsign.py]
|
||||||
|
this does dkim signing stuff
|
||||||
|
|
||||||
|
|
||||||
|
[dkimverify.py]
|
||||||
|
this does dkim verifying stuff
|
||||||
|
|
||||||
|
[dknewkey.py]
|
||||||
|
this generates a diffie-hellman private and public keys
|
||||||
|
|
||||||
|
[dnsplug.py]
|
||||||
|
this gets the DNS record
|
||||||
|
|
||||||
|
[util.py]
|
||||||
|
I'm not sure what this does yet. From the looks of it, it's just a logger and praser for tag value
|
||||||
|
|
||||||
|
-----START TEST DIRECTORY-----
|
||||||
|
|
||||||
|
|
||||||
|
-----START ROOT DIRECTORY-----
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
dkimpy-smtputf8 – an RFC 8616-compliant fork of dkimpy.
|
dkimpy-smtputf8 – an RFC 8616-compliant fork of dkimpy.
|
||||||
|
|
||||||
This fork adds support for internationalized email address (U-labels)
|
This fork adds support for internationalized email address (U-labels converter) and a cheatsheet note for learning
|
||||||
|
|
||||||
|
NOTE: For SMTPUTF8 support, make sure you use A-label (punycoded) domain name instead. Otherwise it will not work, per RFC 8616
|
||||||
|
|
||||||
|
**Another note: The actual repository that's responsible for UTF-8 converter is at** https://gitskette.dailitation.xyz/DandelionNStuff/dkimpy-milter-smtputf8
|
||||||
|
|
||||||
|
As this python module do not actually have the convertor, rather, it's the backend of the milter.
|
||||||
|
|
||||||
# Original README
|
# Original README
|
||||||
|
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ def validate_signature_fields(sig, mandatory_fields=[b'v', b'a', b'b', b'bh', b'
|
|||||||
if b'cv' in sig and sig[b'cv'] not in (CV_Pass, CV_Fail, CV_None):
|
if b'cv' in sig and sig[b'cv'] not in (CV_Pass, CV_Fail, CV_None):
|
||||||
raise ValidationError("cv= value is not valid (%s)" % sig[b'cv'])
|
raise ValidationError("cv= value is not valid (%s)" % sig[b'cv'])
|
||||||
|
|
||||||
|
# Somehow convert it to UTF8 before going to this?
|
||||||
# Limit domain validation to ASCII domains because too hard
|
# Limit domain validation to ASCII domains because too hard
|
||||||
try:
|
try:
|
||||||
str(sig[b'd'], 'ascii')
|
str(sig[b'd'], 'ascii')
|
||||||
@@ -311,6 +312,7 @@ def validate_signature_fields(sig, mandatory_fields=[b'v', b'a', b'b', b'bh', b'
|
|||||||
# Not an ASCII domain
|
# Not an ASCII domain
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Nasty hack to support both str and bytes... check for both the
|
# Nasty hack to support both str and bytes... check for both the
|
||||||
# character and integer values.
|
# character and integer values.
|
||||||
if not arc and b'i' in sig and (
|
if not arc and b'i' in sig and (
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import doctest
|
import doctest
|
||||||
import dkim
|
import dkim
|
||||||
from tests import test_suite
|
from dkim.tests import test_suite
|
||||||
|
|
||||||
doctest.testmod(dkim)
|
doctest.testmod(dkim)
|
||||||
unittest.TextTestRunner().run(test_suite())
|
unittest.TextTestRunner().run(test_suite())
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
fL+5V9EquCZAovKik3pA6Lk9zwCzoEtjIuIqK9ZXHHA=
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
Authentication-Results: lists.example.org; arc=none; spf=pass smtp.mfrom=jqd@d1.example; dkim=pass (1024-bit key) header.i=@d1.example; dmarc=pass
|
||||||
|
Received: from localhost
|
||||||
|
Message-ID: <example@example.com>
|
||||||
|
Date: Mon, 01 Jan 2011 01:02:03 +0400
|
||||||
|
From: Test User <test@example.com>
|
||||||
|
To: somebody@example.com
|
||||||
|
Subject: Testing
|
||||||
|
|
||||||
|
This is a test message.
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
DKIM-Signature: v=1; a=ed25519-sha256; q=dns/txt; c=relaxed/relaxed; d=test.ex
|
||||||
|
; s=sed; h=From:To:Subject; bh=/Ab0giHZitYQbDhFszoqQRUkgqueaX9zatJttIU/plc=;
|
||||||
|
b=5fhyD3EILDrnL4DnkD4hDaeis7+GSzL9GMHrhIDZJjuJ00WD5iI8SQ1q9rDfzFL/Kdw0VIyB4R
|
||||||
|
Dq0a4H6HI+Bw==;
|
||||||
|
Received: from jgh by myhost.test.ex with local (Exim x.yz)
|
||||||
|
envelope-from <jgh@myhost.test.ex>)
|
||||||
|
1dtXln-0000YP-Hb
|
||||||
|
a@test.ex; Sun, 17 Sep 2017 12:29:51 +0100
|
||||||
|
From: nobody@example.com
|
||||||
|
Message-Id: <E1dtXln-0000YP-Hb@myhost.test.ex>
|
||||||
|
Sender: CALLER_NAME <jgh@myhost.test.ex>
|
||||||
|
Date: Sun, 17 Sep 2017 12:29:51 +0100
|
||||||
|
|
||||||
|
content
|
||||||
@@ -52,11 +52,11 @@ class TestSignAndVerify(unittest.TestCase):
|
|||||||
"""End-to-end signature and verification tests."""
|
"""End-to-end signature and verification tests."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.message = read_test_data("ed25519test.msg")
|
self.message = read_test_data("utf8test.msg")
|
||||||
self.message2 = read_test_data("ed25519test2.msg")
|
self.message2 = read_test_data("utf8test2.msg")
|
||||||
self.message3 = read_test_data("rfc6376.msg")
|
self.message3 = read_test_data("rfc6376.msg")
|
||||||
self.message4 = read_test_data("rfc6376.signed.msg")
|
self.message4 = read_test_data("rfc6376.signed.msg")
|
||||||
self.key = read_test_data("ed25519test.key")
|
self.key = read_test_data("utf8.key")
|
||||||
self.rfckey = read_test_data("rfc8032_7_1.key")
|
self.rfckey = read_test_data("rfc8032_7_1.key")
|
||||||
|
|
||||||
def dnsfunc(self, domain, timeout=5):
|
def dnsfunc(self, domain, timeout=5):
|
||||||
|
|||||||
Reference in New Issue
Block a user