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

Make adapters responsible for determining which hash algorithm has been used for message signing #108

Merged
merged 4 commits into from
Sep 6, 2018

Conversation

skalee
Copy link
Contributor

@skalee skalee commented Sep 4, 2018

According to RFC1847, a "multipart/signed" MIME type must be supplied with "micalg" parameter, which tells which hash algorithm has been used in signature calculation. Whereas signature part contains this information as well, declaring this in advance allows for signature verification in one-pass processing.

Fixes #101.

Redefine #compute_signature in every adapter, so that an array composed
of hash algorithm name and actual signature is returned, instead of only
signature.
def multipart_signed_content_type
protocol = sign_protocol
micalg = message_integrity_algorithm
def multipart_signed_content_type(protocol: sign_protocol, micalg: message_integrity_algorithm)

Choose a reason for hiding this comment

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

Line is too long. [101/80]

@codecov
Copy link

codecov bot commented Sep 4, 2018

Codecov Report

Merging #108 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #108      +/-   ##
==========================================
+ Coverage   99.91%   99.91%   +<.01%     
==========================================
  Files          37       37              
  Lines        1204     1237      +33     
==========================================
+ Hits         1203     1236      +33     
  Misses          1        1
Impacted Files Coverage Δ
lib/enmail/helpers/rfc3156.rb 100% <ø> (ø) ⬆️
lib/enmail/adapters/gpgme.rb 100% <100%> (ø) ⬆️
lib/enmail/helpers/rfc1847.rb 100% <100%> (ø) ⬆️
lib/enmail/adapters/rnp.rb 100% <100%> (ø) ⬆️
spec/unit/helpers/rfc1847_spec.rb 100% <100%> (ø) ⬆️
spec/unit/adapters/rnp_spec.rb 100% <100%> (ø) ⬆️
spec/unit/adapters/gpgme_spec.rb 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 215052e...cb81073. Read the comment docs.

Use digest algorithm namereturned by adapter when setting
"multipart/signed" content type.
Message integrity algorithm (micalg) is now required to be returned
from #compute_signature method, hence any defaults are pointless.
@skalee skalee merged commit 4518259 into master Sep 6, 2018
@skalee skalee deleted the one-pass-compat branch September 6, 2018 01:51
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.

2 participants