lib/googleauth/id_tokens/key_sources.rb in googleauth-0.15.1 vs lib/googleauth/id_tokens/key_sources.rb in googleauth-0.16.0

- old
+ new

@@ -169,11 +169,13 @@ raise KeySourceError, "Badly formatted key data" end curve_name = CURVE_NAME_MAP[jwk[:crv]] raise KeySourceError, "Unsupported EC curve #{jwk[:crv]}" unless curve_name group = OpenSSL::PKey::EC::Group.new curve_name - bn = OpenSSL::BN.new ["04" + x_data.unpack1("H*") + y_data.unpack1("H*")].pack("H*"), 2 + x_hex = x_data.unpack1 "H*" + y_hex = y_data.unpack1 "H*" + bn = OpenSSL::BN.new ["04#{x_hex}#{y_hex}"].pack("H*"), 2 key = OpenSSL::PKey::EC.new curve_name key.public_key = OpenSSL::PKey::EC::Point.new group, bn key end end @@ -282,13 +284,13 @@ response = Net::HTTP.get_response uri raise KeySourceError, "Unable to retrieve data from #{uri}" unless response.is_a? Net::HTTPSuccess data = begin - JSON.parse response.body - rescue JSON::ParserError - raise KeySourceError, "Unable to parse JSON" - end + JSON.parse response.body + rescue JSON::ParserError + raise KeySourceError, "Unable to parse JSON" + end @current_keys = Array(interpret_json(data)) end end