Sha256: 4f2103864ee5e4657e3edf44b68056d332815f4b1cfcefcea97cf2916d342b07

Contents?: true

Size: 814 Bytes

Versions: 79

Compression:

Stored size: 814 Bytes

Contents

# encoding: utf-8
require "open3"
OPEN_SSL_TOPK8 = "openssl pkcs8 -nocrypt -topk8 -inform PEM -outform PEM"

# Netty only accepts PKC8 format for the private key, which in the real world is fine
# because any newer version of OpenSSL with use that format by default.
#
# But in Ruby or Jruby-OpenSSL, the private key will be generates in PKCS7, which netty doesn't support.
# Converting the format is a bit of hassle to do in code so In this case its just easier to use the `openssl` binary to do the work.
#
#
def convert_to_pkcs8(key)
  out, e, s = Open3.capture3(OPEN_SSL_TOPK8, :stdin_data => key.to_s)
  # attempt to address random failures by trying again
  unless s.success?
    sleep 1
    out, e, s = Open3.capture3(OPEN_SSL_TOPK8, :stdin_data => key.to_s)
    raise e if e != ""
    out
  end

  out
end

Version data entries

79 entries across 79 versions & 1 rubygems

Version Path
logstash-input-beats-7.0.2-java spec/support/helpers.rb
logstash-input-beats-6.9.3-java spec/support/helpers.rb
logstash-input-beats-6.9.2-java spec/support/helpers.rb
logstash-input-beats-7.0.1-java spec/support/helpers.rb
logstash-input-beats-7.0.0-java spec/support/helpers.rb
logstash-input-beats-6.9.1-java spec/support/helpers.rb
logstash-input-beats-6.9.0-java spec/support/helpers.rb
logstash-input-beats-6.8.4-java spec/support/helpers.rb
logstash-input-beats-6.8.3-java spec/support/helpers.rb
logstash-input-beats-6.8.2-java spec/support/helpers.rb
logstash-input-beats-6.8.1-java spec/support/helpers.rb
logstash-input-beats-6.8.0-java spec/support/helpers.rb
logstash-input-beats-6.7.2-java spec/support/helpers.rb
logstash-input-beats-6.7.1-java spec/support/helpers.rb
logstash-input-beats-6.7.0-java spec/support/helpers.rb
logstash-input-beats-6.6.4-java spec/support/helpers.rb
logstash-input-beats-6.6.3-java spec/support/helpers.rb
logstash-input-beats-6.6.2-java spec/support/helpers.rb
logstash-input-beats-6.6.1-java spec/support/helpers.rb
logstash-input-beats-6.6.0-java spec/support/helpers.rb