Class: GenRelease::Commands::Sign

Inherits:
Object
  • Object
show all
Defined in:
lib/genRelease/commands/sign.rb

Constant Summary collapse

FILENAME =
"Release.rsa"

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Sign

Returns a new instance of Sign.



8
9
10
11
# File 'lib/genRelease/commands/sign.rb', line 8

def initialize options
  @options = options
  @current_dir = Dir.getwd
end

Instance Method Details

#signObject



13
14
15
16
17
18
# File 'lib/genRelease/commands/sign.rb', line 13

def sign
  @rsa = ::OpenSSL::PKey::RSA.new File.read "#{@current_dir}#{File::SEPARATOR}rsa.pem"
  content = File.open("#{@current_dir}#{File::SEPARATOR}Release",'rb') {|file| file.read}
  message = @rsa.private_encrypt(content.gsub("\n",""))
  ::GenRelease::FileUtils::write "#{@current_dir}#{File::SEPARATOR}#{FILENAME}",message
end