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

Add timestamp signature handler #301

Merged
merged 6 commits into from
Apr 22, 2020
Merged

Add timestamp signature handler #301

merged 6 commits into from
Apr 22, 2020

Conversation

a5i
Copy link
Contributor

@a5i a5i commented Apr 9, 2020

This change is Reviewable

@codecov
Copy link

codecov bot commented Apr 9, 2020

Codecov Report

Merging #301 into development will decrease coverage by 9.93%.
The diff coverage is 54.12%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #301      +/-   ##
===============================================
- Coverage        62.24%   52.30%   -9.94%     
===============================================
  Files              235      236       +1     
  Lines            45395    45556     +161     
===============================================
- Hits             28256    23828    -4428     
- Misses           16498    18650    +2152     
- Partials           641     3078    +2437     
Impacted Files Coverage Δ
model/sighandler/sighandler_pkcs7.go 52.87% <ø> (-9.20%) ⬇️
model/sighandler/sighandler_timestamp.go 53.27% <53.27%> (ø)
model/signature_handler.go 55.85% <100.00%> (-14.79%) ⬇️
internal/jbig2/globals.go 0.00% <0.00%> (-100.00%) ⬇️
internal/e2etest/memory_measure.go 0.00% <0.00%> (-100.00%) ⬇️
internal/jbig2/decode.go 0.00% <0.00%> (-80.00%) ⬇️
internal/e2etest/utils.go 0.00% <0.00%> (-80.00%) ⬇️
internal/e2etest/validate.go 0.00% <0.00%> (-80.00%) ⬇️
model/flatten.go 0.00% <0.00%> (-76.15%) ⬇️
annotator/field_appearance.go 10.83% <0.00%> (-44.96%) ⬇️
... and 157 more

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 971a00f...cf88c9b. Read the comment docs.

@gunnsth gunnsth changed the base branch from master to development April 9, 2020 23:06
@gunnsth gunnsth requested a review from adrg April 9, 2020 23:07
@gunnsth
Copy link
Contributor

gunnsth commented Apr 10, 2020

@a5i Can you add documentation and example/testcase how to combine signing and timestamping also.

If we follow PAdES signature flow we need to append digital signature to PDF and after it add timestamp signature. We should use the next algorithm

  1. save/generate a document with digital sign with Appender
  2. open the document and save/generate the document with timestamp sign with Appender

Would be good to have a testcase that does this.

Copy link
Collaborator

@adrg adrg left a comment

Choose a reason for hiding this comment

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

Looks good overall. I added a couple of observations.

model/sighandler/sighandler_timestamp.go Outdated Show resolved Hide resolved
model/sighandler/sighandler_timestamp.go Show resolved Hide resolved
model/sighandler/sighandler_timestamp.go Outdated Show resolved Hide resolved
model/sighandler/sighandler_timestamp.go Outdated Show resolved Hide resolved
model/sighandler/sighandler_timestamp.go Outdated Show resolved Hide resolved
model/sighandler/sighandler_timestamp.go Outdated Show resolved Hide resolved
model/appender_test.go Outdated Show resolved Hide resolved
model/sighandler/sighandler_timestamp.go Outdated Show resolved Hide resolved
@gunnsth gunnsth requested a review from adrg April 17, 2020 14:44
Copy link
Collaborator

@adrg adrg left a comment

Choose a reason for hiding this comment

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

I left two minor observations. Other than that, everything looks good to me.

}

if resp.StatusCode != http.StatusOK {
return fmt.Errorf("http status code wiats 200 got %d", resp.StatusCode)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please correct the error message. Also, might be more efficient to do the status code check before ioutil.ReadAll(resp.Body) as the body is not relevant if the request was not successful. Another option would be to leave the status code check where it is now and also print the response body in order to identify the issue easily (maybe print the response body in a common.Log.Debug call for status != 200).

model/sighandler/sighandler_timestamp.go Outdated Show resolved Hide resolved
Copy link
Contributor

@gunnsth gunnsth left a comment

Choose a reason for hiding this comment

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

LGTM

@gunnsth gunnsth merged commit a69d788 into unidoc:development Apr 22, 2020
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.

3 participants