lib/travis/tools/ssl_key.rb in travis-1.11.1 vs lib/travis/tools/ssl_key.rb in travis-1.12.0

- old
+ new

@@ -1,12 +1,14 @@ +# frozen_string_literal: true + require 'openssl' require 'base64' module Travis module Tools module SSLKey - extend self + module_function def generate_rsa(size = 2048) OpenSSL::PKey::RSA.generate(size) end @@ -38,10 +40,11 @@ bytes = to_byte_array(value.to_i) [bytes.size, *bytes].pack('NC*') end def to_byte_array(num, *significant) - return significant if num.between?(-1, 0) and significant[0][7] == num[7] + return significant if num.between?(-1, 0) && (significant[0][7] == num[7]) + to_byte_array(*num.divmod(256)) + significant end end end end