Is there generic Encryption / Masking Tool available ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Is there generic Encryption / Masking Tool available ?
# 1  
Old 10-08-2016
Hammer & Screwdriver Is there generic Encryption / Masking Tool available ?

I was using crypt command to mask and unmask my password in the script in Linux.

But, I don't find crypt on SunOS mymac 5.10 Generic_150400-26 sun4v sparc sun4v

Thus, my script fails.

Is there a generic / more common command tool / script across Linux and Unix (most / all flavors) that I can use across different OS whichout have to change the Masking / Unmasking code in my script when moving between different systems?

Please suggest.
# 2  
Old 10-08-2016
crypt() in unistd.h is supposed to be part of the C library standard and the command crypt does exist for Solaris:
https://www.unix.com/man-page/opensolaris/1/crypt/
The Open Group Base Specifications Issue 7, 2016 Edition

I've not had your problem on Solaris 9, 10, or 11.

Could something be wonky with the PATH variable? Solaris does have an oddity path-wise - the /usr/xpg4/bin - /usr/bin deal where really old versions of something like awk exist in /usr/bin and newer versions of commands in /usr/x???/bin

Try this
Code:
find /usr/bin /usr/xpg?/bin /usr/ucb  -type f -name crypt

So, something is wonky somewhere, probably on your environment side - as a guess.
crypt has been on every UNIX and UNIX-like system I have seen.
# 3  
Old 10-08-2016
The crypt() function is required by the POSIX Standard (and is there so passwords can be encrypted). But that is a one-way operation. You can use crypt() to encrypt your password and you can use crypt() to encode a user-entered password guess and then use strcmp() to see if the two encrypted strings match.

There is also the encrypt() function (which is in the current standards) and the crypt utility (which is not in the current standards), which are capable of encoding and decoding text. But, US government regulations prohibit exporting that code to many other countries. So while a Solaris system shipped by Oracle to a US customer might contain the crypt utility and the encrypt() function, a corresponding Solaris system sent to China, Iran, or Russia (and maybe any other country outside the US borders) would get a an encrypt() function in libc that always fails and returns with errno set to ENOTSUP when asked to decode encrypted text (and maybe also when asked to encode text). I no idea whether systems Oracle ships with the reduced capability encrypt() are shipped with a non-functioning crypt utility or if it is dropped from the distribution completely.
# 4  
Old 10-10-2016
Oracle

Quote:
Originally Posted by jim mcnamara
crypt() in unistd.h is supposed to be part of the C library standard and the command crypt does exist for Solaris:
Try this
Code:
find /usr/bin /usr/xpg?/bin /usr/ucb  -type f -name crypt

So, something is wonky somewhere, probably on your environment side - as a guess.
crypt has been on every UNIX and UNIX-like system I have seen.
Sorry, I don't find crypt on Linux.

Code:
bash-3.2$ find /usr/bin /usr/xpg?/bin /usr/ucb  -type f -name crypt
find: /usr/xpg?: No such file or directory
find: /usr/ucb: No such file or directory
bash-3.2$ uname -a
Linux mymac 2.6.18-410.el5 #1 SMP Fri Apr 8 05:48:52 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

Thus, my question remains ...Is there a generic command for masking passwords that works on most Unix / Linux systems.

I tried the below but i don't find them on most systems.
Code:
crypt
base64
openssl

Please suggest.
# 5  
Old 10-10-2016
Hi,
Maybe with perl one liner - see perldoc -f crypt (if perl works on your all Unix / Linux systems).
Regards.
# 6  
Old 10-10-2016
Quote:
Originally Posted by jim mcnamara
and the command crypt does exist for Solaris:
https://www.unix.com/man-page/opensolaris/1/crypt/
Quote:
Originally Posted by mohtashims
Sorry, I don't find crypt on Linux.
I hate to state the obvious but: care to extemporate on the fact that Linux is not Solaris and vice versa?

What's more, Linux is not POSIX, so there might be a crypt() function built into its system library, but there is no guarantee for that. Any POSIX-compliant UNIX, though, has to have this function, as Don Cragun and Jim McNamara have pointed out.

I hope this helps.

bakunin
# 7  
Old 10-11-2016
Is this not a flawed project in any case? If the code is written to en/decrypt, then anyone reading the code can decrypt, so your security is lost.

What external key do you have to validate the user? A one-way encryption and user entry would be better.

If you are looking to store a password for use connecting to another system for a process to be performed or data transferred, you would probably be better investigating SSH keys.


Can you tell us more about the purpose of the code?



Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Masking algorithm

I have a requirement of masking few specific fields in the UNIX file. The details are as following- File is fixed length file with each record of 250 charater length. 2 fields needs to be masked – the positions are 21:30 and 110:120 The character by character making needs to be done which... (5 Replies)
Discussion started by: n78298
5 Replies

2. Cybersecurity

File encryption tools with MAC address as an encryption key

Hi all, I'm looking for secure file encryption tools that use MAC address as encryption key. FYI, I'm using Red Hat Enterprise Linux OS. For example: when A wants to send file to B A will encrypt the file with B's computer MAC/IP address as an encryption key This file can only be decrypted... (2 Replies)
Discussion started by: sergionicosta
2 Replies

3. Programming

Masking Password with *'s

So I've been working on this for some time now and can't seem to find the solution that works for me. I'm working in C/Unix. Basically, I want to take a user input and output something different. For example, I want to take a password and output *'s. In another instance, I want to take inputed... (35 Replies)
Discussion started by: bigdrock44
35 Replies

4. Shell Programming and Scripting

masking issue

Hi I am facing an issue with the below script which has the below line each field being separated with a tab. I need to mask the 8 and 7th field based on following conditions 1. 8th field is 16 in length and is numerics i will mask the middle 6 digits except the first 6 and last 4. input... (2 Replies)
Discussion started by: mad_man12
2 Replies

5. Emergency UNIX and Linux Support

Masking of number

BAT:0310:2009-08-0:Y4 :H:D:00003721:03103721.IFH:00138770:05767:00000000001279' EXR:CLP:912.570000' STA:A:9071559:2009-08-10::Wer::Mrs' DEF::531.97:531.97:310221661617::+ABC:BAL:1:N::::5:40.00:0.00:2009-08-10:CN:1111111111109962::3:N:missc :N:PH:00010833:... (5 Replies)
Discussion started by: mad_man12
5 Replies

6. UNIX for Advanced & Expert Users

Encryption Tool for SCO OPenserver

What would you recommend for encryption on a SCO unix box, with local application only? My box is not on the internet, and all I want to do is take a text file of digits and encrypt them. Should I try to write my own program, or is there a tool I can use or buy? (3 Replies)
Discussion started by: coreysan
3 Replies

7. UNIX for Dummies Questions & Answers

File encryption/Key encryption ????

My dilemma, I need to send, deemed confidential, information via e-mail (SMTP). This information is sitting as a file on AIX. Typically I can send this data as a e-mail attachment via what we term a "mail filter" using telnet. I now would like to somehow encrypt the data and send it to a e-mail... (1 Reply)
Discussion started by: hugow
1 Replies

8. IP Networking

IP Masking

Is it possible for a internal LAN to mask a IP e.g. i have a server ip running the intranet ip being 192.168.0.8 and i want to make that like www.intranet.com is this possible on a internal network ? (1 Reply)
Discussion started by: perleo
1 Replies
Login or Register to Ask a Question