Skip to content

[fix] TXT encryption broken #273

Open
@mobad

Description

@mobad

Describe the bug

Description:
If you use https://forwardemail.net/en/encrypt to encrypt a TXT record you'll notice that you only get a short base64 value no matter how long the input email is and that value gives errors when used as a TXT record.

I think the issue is

(Or at least part of the issue, not sure why the output is so short and doesn't include the '-' part after the IV)

Here it generates a random IV of length 12 then converts it to hex then takes the first 12 bytes, but since a hex string doubles the string length this only gets 6 actual bytes.
It also looks like createCipheriv expect a binary IV so providing hex would also reduce entropy.
Not sure if something similar isn't happening with the encryption key as well.

It looks like the gist used as an example has some issues that were addressed here https://gist.github.com/vlucas/2bd40f62d20c1d49237a109d491974eb?permalink_comment_id=4902700#gistcomment-4902700

Also the API has an incorrect cURL example https://forwardemail.net/en/email-api#encrypt
It should be -d "input=email"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions