Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZMS-125 #617

Merged
merged 4 commits into from Feb 19, 2024
Merged

ZMS-125 #617

merged 4 commits into from Feb 19, 2024

Conversation

NickOvt
Copy link
Contributor

@NickOvt NickOvt commented Feb 7, 2024

  • Added ed25519 assymetric crypographic keys support for DKIM

@NickOvt NickOvt requested a review from andris9 February 7, 2024 07:45
@NickOvt NickOvt self-assigned this Feb 7, 2024
@NickOvt NickOvt changed the title dkim, add support for ed25519 ZMS-125 Feb 7, 2024
Copy link
Member

@andris9 andris9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WildDuck should be able to accept the following example values as private key for ed25519 (both are the same keys):

  1. PEM encoded value
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIJ1hsZ3v/VpguoRK9JLsLMREScVpezJpGXA7rAMcrn9g
-----END PRIVATE KEY-----
  1. raw keys (base64 encoded)
nWGxne/9WmC6hEr0kuwsxERJxWl7MmkZcDusAxyuf2A=

Raw ed25519 keys are always 32 byte binary, so 44 bytes as base64 (or 43 bytes as base64url or if the ending "=" padding is removed). You can find an example for converting raw ed25519 key to pem here (not the best solution, but the easiest)

There is no need to store DER encoded public key as it is just an alternative form for PEM (DER is the same value as PEM but without the ---BEGIN/END--- padding, and it is binary, not base64)

You can convert the public key file object to ed25519 public key (this is not pem and not der!) with this approach (basically just cut away the ASN padding):

const ed25518PubKey = publicKey.export({ format: 'der', type: 'spki' }).subarray(12).toString('base64');

@NickOvt NickOvt merged commit 3d7d0a6 into master Feb 19, 2024
7 checks passed
@NickOvt NickOvt deleted the ZMS-125 branch February 19, 2024 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants