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

Confusion in the micalg parameter value for SHA-X algorithms. #790

Closed
fyodorklimenko opened this issue May 2, 2022 · 1 comment
Closed
Labels
compatibility Compatibility with existing software

Comments

@fyodorklimenko
Copy link
Contributor

According to the RFC-3851, micalg parameter value SHOULD be from the following:
md5, sha1, sha256, sha384, sha512, etc.
There is no dash in the SHA-X algorithm value.

According to the RFC-5751, micalg parameter value SHOULD be from the following:
md5, sha-1, sha-224, sha-256, sha-384, sha-512, etc.
There is a dash in the SHA-X algorithm value.

RFC-5751 obsoletes RFC-3851 and that's why MimeKit uses dashes in SHA-X values.

public override string GetDigestAlgorithmName (DigestAlgorithm micalg)

I completely agree with your decision to follow the newest RFC.

On the other side, OpenSSL doesn't follow RFC-3851 or RFC-5751.
There is a mixed set of values:
md5, sha1, sha-256, sha-384, sha-512, etc.
I want to mention that only sha1 does not contain a dash. All others SHA-X do.

Do you know why OpenSSL mixes the notation? It uses RFC-3851 for sha1 and RFC-5751 for others.

I don't see any reason (except the historical one).
But maybe you (as an expert) have got some ideas.

P.S.
Thank you for your great library and your efforts.
I should ask this question in the OpenSSL repository but this micalg mismatch drives me crazy and maybe you'll find a time to answer me.

jstedfast added a commit that referenced this issue May 3, 2022
@jstedfast
Copy link
Owner

Good catch, I hadn't noticed.

All I can think of is that OpenSSL is doing that for historical reasons. If you find out otherwise, let me know.

In the meantime, MimeKit could at least handle "sha1" and "sha-1" (etc) as the same so that it can get the correct DigestAlgorithm enum. I'll push a fix to do that.

@jstedfast jstedfast added the compatibility Compatibility with existing software label May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Compatibility with existing software
Projects
None yet
Development

No branches or pull requests

2 participants