Operating System - HP-UX
1832142 Members
2979 Online
110038 Solutions
New Discussion

Re: Perl coding question, topic Password encryption

 
SOLVED
Go to solution
generic_1
Respected Contributor

Perl coding question, topic Password encryption

Hello Everyone
I was wondering if anyone had a good example of a function to ask for a password, encrypt it to store in a file that would be decrypted back to a variable when your app needs it later.

This is not a web or cgi type scripting I am working on, only Perl.

The It would be useful if the encryption part could run separate from the decryption and without user intervention.

The reason I am looking is I would rather my automated Perl Scripts did not store open text passwords, and I would like more security than locking down a directory.

So bascically I am looking for a perl script to run ask for a password to add to a file encrypted.

Then another piece of Perl code that could decrypt it to a easy to use variable so your program could use it without having to be interactive with the user asking for any input.

Not to confuse the question but after I am done with the unencrypted variable in the program should I shoot trash into it/zero it before the program exit to be extra safe, its all Perl by the way?

Many Thanks
5 REPLIES 5
H.Merijn Brand (procura
Honored Contributor

Re: Perl coding question, topic Password encryption

# man perlfaq8

# perldoc -q "How do I ask the user for a password?"

# perldoc -f crypt

It's all in there, including examples

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
generic_1
Respected Contributor

Re: Perl coding question, topic Password encryption

I looked at the code and tested it but its not doing really what im looking to do.

I am looking not to store any unencrypted passwords in text files. The only time I intend to enter a password is to encrypt it. I do not want to have to retype it every time the app launches. This a cron/scheduled application I am working on.

More along the lines of public and private keys, but the result producing the password the app will use. They are not OS user accounts either.
Pat Lieberg
Valued Contributor
Solution

Re: Perl coding question, topic Password encryption

H.Merijn Brand (procura
Honored Contributor

Re: Perl coding question, topic Password encryption

Store it in shared memory :)
In encrypted form of course

# man perlipc

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
generic_1
Respected Contributor

Re: Perl coding question, topic Password encryption

javascript:openExternal('http://search.cpan.org/~amackey/Data-Encrypted-0.07/Encrypted.pm')

Have you used this module under HPUX with Luck. It looks like it has allot of the functionality I am looking for for storing passwords for scripting.

Thanks Everyone.