Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Improve multi-recipient/multi-sig handling #111

Merged
merged 1 commit into from
Sep 22, 2016
Merged

Conversation

csstaub
Copy link
Collaborator

@csstaub csstaub commented Sep 22, 2016

Improvements to multi-recipient/multi-sig handling.

  • Remove support for multi-recipient/multi-sig in Decrypt and Verify.
  • Introduce new VerifyMulti and DecryptMulti functions for old use-cases.
  • Improve documentation around multi-recipient/multi-sig a bit.

The new VerifyMulti and DecryptMulti functions will return the index of the recipient/signature that has been verified, along with the header or signature object. This ensures that callers don't accidentally verify one signature but then read headers from another, as the old Verify or Decrypt didn't say which recipient/signature ended up being valid.

Because this is a subtle API change, it will likely be released as v1.1.0 once merged into the v1 branch. I'm not aware of any public projects using this library that depend on multi-sig so I think it's acceptable to still call this v1.

}

// The "zip" header parameter may only be present in the protected header.
if obj.protected.Zip != "" {
plaintext, err = decompress(obj.protected.Zip, plaintext)
}

return plaintext, err
return index, headers.sanitized(), plaintext, err
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be cleaner to not return index, headers and plaintext if err is set here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Code here will not execute if decryption failed (will return on the plaintext is nil check above).

}

if i != 1 {
t.Fatal("recipient index should be 0 for RSA key")
Copy link
Contributor

Choose a reason for hiding this comment

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

s/0/1/ ?

@csstaub csstaub merged commit 2c5656a into master Sep 22, 2016
@csstaub csstaub deleted the cs/better-multi branch September 22, 2016 23:24
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants