Skip to content

Commit

Permalink
Changes to allow OpenSSL3 to work
Browse files Browse the repository at this point in the history
  • Loading branch information
AnilRh committed Mar 19, 2024
1 parent 061ff9a commit bf62807
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/webpush/encryption.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ def encrypt(message, p256dh, auth)
group_name = 'prime256v1'
salt = Random.new.bytes(16)

server = OpenSSL::PKey::EC.new(group_name)
server.generate_key
server_public_key_bn = server.public_key.to_bn
key = OpenSSL::PKey::EC.generate(group_name)
server_public_key_bn = key.public_key.to_bn

group = OpenSSL::PKey::EC::Group.new(group_name)
client_public_key_bn = OpenSSL::BN.new(Webpush.decode64(p256dh), 2)
Expand Down
3 changes: 1 addition & 2 deletions lib/webpush/vapid_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def self.from_pem(pem)
attr_reader :curve

def initialize
@curve = OpenSSL::PKey::EC.new('prime256v1')
@curve.generate_key
@curve = OpenSSL::PKey::EC.generate('prime256v1')
end

# Retrieve the encoded elliptic curve public key for VAPID protocol
Expand Down

1 comment on commit bf62807

@jimedelstein
Copy link

Choose a reason for hiding this comment

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

@AnilRh did you see this open PR that does the same thing? The changes were a bit more extensive, not sure if that was out of necessity though, but I figured it was worth looking over: #106

Please sign in to comment.