From: Robert Klemme Date: 2009-02-06T22:46:02+09:00 Subject: Re: Best way to encrypt/decrypt a word 2009/2/5 Ruby Student > > On Thu, Feb 5, 2009 at 2:52 PM, Iñaki Baz Castillo wrote: > > > El Jueves, 5 de Febrero de 2009, Ruby Student escribió: > > > Hello Team, > > > > > > I have the need to encrypt/decrypt a one word string. The encrypted word > > > will be saved in a file. > > > Later the word will be picked-up from the file, decrypt it at execution > > > time, and use it as a UNIX password to perform certain function that > > > requires authentication. > > > What Ruby facility is available for this simple function? > > > > The problem is: > > Even if the UNIX password is encrypted by the Ruby programm, if an attacker > > can see the Ruby code it can know how to decrypt it. > You are correct. However, we are behind several firewalls. > Also, the file with the encripted password will be place within a "secured" > dir. Well... I'd rather do something different: set up ssh with ssh-agent so that you can do automated logins. Not sure whether that works with Ruby's Net::SSH but you can fork a SSH shell via system or IO.popen. Of course, in this scenario someone has to enter the passphrase once... My 0.02EUR Kind regards robert -- remember.guy do |as, often| as.you_can - without end