HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/rubygems-3.0.9/util/create_encrypted_key.rb
# frozen_string_literal: true
require 'openssl'

test_path = File.expand_path('../../test/rubygems', __FILE__)

private_key_path = "#{test_path}/private_key.pem"

key = OpenSSL::PKey::RSA.new File.read private_key_path

cipher = OpenSSL::Cipher.new 'DES-CBC'

encrypted_key_path = "#{test_path}/encrypted_private_key.pem"

open encrypted_key_path, 'w' do |io|
  io.write key.to_pem cipher, 'Foo bar'
end