Sponsored Content
Full Discussion: Encrypt and decrypt a string
Top Forums Shell Programming and Scripting Encrypt and decrypt a string Post 302505454 by LivinFree on Thursday 17th of March 2011 02:42:43 AM
Old 03-17-2011
I agree with Corona - the problem here is storing the password if you plan on making this script run without intervention.

If you plan on having it prompt you for a password, which has limited use, but I'll entertain the possibility for operations automation or something, you can use a utility like openssl.

Code:
$ echo Hi | openssl enc -aes-128-cbc -a -salt -pass pass:wtf
U2FsdGVkX18qAdhqop1SffsewHue6EOPNKv9dXc/0rI=
$ echo U2FsdGVkX18qAdhqop1SffsewHue6EOPNKv9dXc/0rI= | openssl enc -aes-128-cbc -a -d -salt -pass pass:wtf
Hi
$

You can also use openssl for ad-hoc file encryption/decryption with the "-in" and "-out" options. You can also use GPG for file encryption/decryption.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Encrypt & Decrypt a String

Hi Everybody, I have a script that telnet another system. For some reasons, this is should be done by "root", so the root password has been written explicitly in this script, which mean any body read this script will know the root password of the other system. I think the solution is to write... (6 Replies)
Discussion started by: aldowsary
6 Replies

2. Shell Programming and Scripting

encrypt and decrypt password

how do i encrypt and decrypt a password (2 Replies)
Discussion started by: sanwish
2 Replies

3. Solaris

Decrypt Des file - then encrypt

Help.. I need to decrypt a file that was encrypted using DES 56 Bit. I have the encryption key and the block size used but no idea what utility to use.. I then need to encrypt the file using pgp and another key I have.. againt I dont know what utility to use. I am running solaris 9 .... ... (0 Replies)
Discussion started by: frustrated1
0 Replies

4. Shell Programming and Scripting

Encrypt and Decrypt script

Dear Experts, I am using one script name :volume.sh and its written in bash shell script. I just want to encrypt the script so that any one else cannot see it. please tell me the commands how to encrypt the script as well as to decrypt it. Regards, SHARY (9 Replies)
Discussion started by: shary
9 Replies

5. Shell Programming and Scripting

How to encrypt and decrypt a file

How to encrypt and decrypt a file using unix Command? Can any one help me? (2 Replies)
Discussion started by: laknar
2 Replies

6. Shell Programming and Scripting

Encrypt/Decrypt string with rsa keys

Hello, I wanted to know if there was a way to encrypt a string, not a file using openssl and then decrypt it? I cant seem to get it to work. This is what I have been trying but I'm not having much luck. encTxt=`echo "$1" | openssl dgst -sha1 -binary | openssl rsautl -sign -inkey... (1 Reply)
Discussion started by: tjones1105
1 Replies

7. Shell Programming and Scripting

Encrypt and Decrypt

I have script for all oracle prod db. I have hard coded the username / password. I need a mechanism to encode and decode the username / password in a shell script. Another challenge is I use the username and password in a Select command for oracle DB. How can call the decrypted... (2 Replies)
Discussion started by: ilugopal
2 Replies

8. Programming

Encrypt and Decrypt file using RIJNDAEL-128

Hi All, Can I use MCRYPT - (RIJNDAEL-128) / CBC mode to encrypt and decrypt a file? I am trying to find some sample C program on internet, which will encrypt and decrypt a file. But was not able to find any thing. Can some help me with the programming. Thanks. (1 Reply)
Discussion started by: Shre
1 Replies

9. Shell Programming and Scripting

Encrypt and decrypt the password in a Shell Script

Hello, I have the following UNIX shell script which connects to the teradata database and executes the SQL Queries. For this, I am passing database name, username and password. I don't want to reveal my password to anyone. So, is there any way that I can encrypt my password and read the... (2 Replies)
Discussion started by: ronitreddy
2 Replies

10. UNIX for Beginners Questions & Answers

Encrypt and Decrypt a File with Password

Hello, I have few files on unix which are payroll related and I need them to encrypt with password so others wouldn't see the data. I use ETL tool and would like to know the unix command that does encryption/decryption to use in the ETL. Thank you, Sri (3 Replies)
Discussion started by: eskay
3 Replies
shishi_3des(3)							      shishi							    shishi_3des(3)

NAME
shishi_3des - API function SYNOPSIS
#include <shishi.h> int shishi_3des(Shishi * handle, int decryptp, const char key[8], const char iv[8], char * ivout[8], const char * in, size_t inlen, char ** out); ARGUMENTS
Shishi * handle shishi handle as allocated by shishi_init(). int decryptp 0 to indicate encryption, non-0 to indicate decryption. const char key[8] const char iv[8] char * ivout[8] const char * in input character array of data to encrypt/decrypt. size_t inlen length of input character array of data to encrypt/decrypt. char ** out newly allocated character array with encrypted/decrypted data. DESCRIPTION
Encrypt or decrypt data (depending on decryptp) using 3DES in CBC mode. The out buffer must be deallocated by the caller. RETURN VALUE
Returns SHISHI_OK iff successful. REPORTING BUGS
Report bugs to <bug-shishi@gnu.org>. COPYRIGHT
Copyright (C) 2002-2010 Simon Josefsson. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. SEE ALSO
The full documentation for shishi is maintained as a Texinfo manual. If the info and shishi programs are properly installed at your site, the command info shishi should give you access to the complete manual. shishi 1.0.1 shishi_3des(3)
All times are GMT -4. The time now is 04:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy