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

Extract encryption module #4

Merged
merged 3 commits into from
May 12, 2016
Merged

Conversation

rossta
Copy link
Collaborator

@rossta rossta commented May 11, 2016

This PR adds a test for the encryption functionality. The methods specific to encrypting the payload including #encrypt have been extracted to a new module Webpush::Encryption (separation of concerns, testing, etc).


group = OpenSSL::PKey::EC::Group.new(group_name)
client_public_key_bn = OpenSSL::BN.new(Base64.urlsafe_decode64(p256dh), 2)
client_public_key = OpenSSL::PKey::EC::Point.new(group, client_public_key_bn)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Creation of the client_public_key was simplified by using Base64.urlsafe_decode64(p256dh), 2 to construct the the OpenSSL::BN object.

Add ece as development dependency

Update gemspec
Includes spec against third party implementation of the http encrypted
content encoding - the ece gem
@rossta rossta force-pushed the extract_encryption_module branch from 1ef7131 to 20dfb09 Compare May 11, 2016 20:26
[key.to_s(16)].pack("H*")
end

def unescape_base64(base64)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This method was removed in the new module. It's no longer needed since the client keys are decoded with Base64.urlsafe_decode64

@zaru zaru merged commit 20dfb09 into zaru:master May 12, 2016
@zaru
Copy link
Owner

zaru commented May 12, 2016

@rossta
Thank you for the wonderful pull request.
It became very study.

@rossta
Copy link
Collaborator Author

rossta commented May 12, 2016

@zaru Great! Thanks for the quick review, merge, and new release.

zaru pushed a commit that referenced this pull request Aug 15, 2019
fixes for decryption tests
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