Sponsored Content
Full Discussion: openssl DES3 in scripting
Top Forums Shell Programming and Scripting openssl DES3 in scripting Post 302415674 by kazikamuntu on Saturday 24th of April 2010 07:17:23 AM
Old 04-24-2010
openssl DES3 in scripting

hi,
I have this script in python

Code:
#!/usr/bin/env python
from Crypto.Cipher import DES3

def desEncrypt(key, data): 
    d = des4me(key) 
    return d.encrypt(data)

def des4me(key): 
    return DES3.new(key, DES3.MODE_ECB)

A='\x00\x11\x22\x33\xA8\x44\x55\x66\x92\x77\x88\xAC\x99\x94\x88\x11'
B='\x0c\xef\x83\x44\x34\x00\x00\xca'
print desEncrypt(A,B)

The result is in hex d2b3 1881 f6fc d951
And i want to to make the same output with openssl in a bash shell
I've tried with

Code:
A=$(echo -ne "\x00\x11\x22\x33\xA8\x44\x55\x66\x92\x77\x88\xAC\x99\x94\x88\x11")
B=$(echo -ne "\x0c\xef\x83\x44\x34\x00\x00\xca")
echo -ne "$A"|openssl des-ede3 -nosalt -nopad -pass pass:$B|xxd

but the result is not the same.
I think that des-ede3 is the correct translation of DES3.MODE_ECB.
I don't understand my error..
Please help me (isn't a homework!!)
Best regards

---------- Post updated at 06:04 AM ---------- Previous update was at 04:45 AM ----------

it's a base problem or the mode is incorrect? I tried for several hours...but no solution.Anyone can help me?

---------- Post updated at 03:22 PM ---------- Previous update was at 06:04 AM ----------

anyone can help me?

---------- Post updated 04-24-10 at 06:17 AM ---------- Previous update was 04-23-10 at 03:22 PM ----------

I've tried also with this:
Code:
echo -e -n "\x0c\xef\x83\x44\x34\x00\x00\xca"|openssl des-ede3 -nosalt -nopad -pass pass:"\x00\x11\x22\x33\xA8\x44\x55\x66\x92\x77\x88\xAC\x99\x94\x88\x11"|xxd -p

But the result is wrong 6559f7f970062198....

Last edited by kazikamuntu; 04-23-2010 at 07:30 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

openssl help

I ungraded my openssl on sun solaris 8 from openssl 0.9.6c to openssl 0.9.6g the ungrade went fine but when I tried to ssh in to server, I received the following error message "ld.so.1: ./sshd: fatal: relocation error: file /usr/local/ssl/lib/libcrypto.so.0.9.6: symbol main: referenced symbol... (2 Replies)
Discussion started by: hassan2
2 Replies

2. Solaris

ERROR OpenSSL

ERROR OpenSSL version mismatch. Built against 908070, you have 9080bf^M 2009.11.20 15:23:25 ERROR Connection closed^M i am new in solaris,i not have great know in this operative system Help me how i can fixed this, in the machine has installed Solaris Machine hardware: ... (1 Reply)
Discussion started by: saurio
1 Replies

3. UNIX for Advanced & Expert Users

DES3 encryption in SunOS sparc

Hi, I want to encrypt a unix file using the des3 algorithm. Seems that there are no standard unix utilities readily available. Can you please suggest how I can encrypt a unix file using des3 ? (2 Replies)
Discussion started by: samuel.vincent
2 Replies

4. UNIX for Advanced & Expert Users

Using openssl

All, I am new to openssl and I have not been able to figure out exactly how to use it. What I need to do is to create a shell script which FTPS's (SFTP is not allowed on my project) a file to a mainframe. The mainframe will not initiate a session with my server. Question. Are the packages... (7 Replies)
Discussion started by: MichaelInDC
7 Replies

5. Solaris

Openssl 0.9.8r

Hi Peeps, Having trouble compiling openssl 0.9.8r on Solaris 10 x86. The make test fails when running the shatests (segmentation faults). There is a PROBLEM file that references a file called values.c. Anyone know whereabouts in the source tree you put this file as the file doesn't tell you... (2 Replies)
Discussion started by: callmebob
2 Replies

6. UNIX for Advanced & Expert Users

Compression with openssl

Hi , 1-I need to know please if it's possible to compress using openssl? Here is the version used: openssl version -a OpenSSL 0.9.7d 17 Mar 2004 (+ security fixes for: CVE-2005-2969 CVE-2006-2937 CVE-2006-2940 CVE2006-3738 CVE-2006-4339 CVE-2006-4343 CVE-2007-5135 CVE-2008-5077... (3 Replies)
Discussion started by: Eman_in_forum
3 Replies

7. Cybersecurity

OpenSSL

I just started playing around with Unix's OpenSSL utility. I can't seem to get the hang of it, and the man page isn't helping much. I wanted to experiment with file encryption, so I created a dummy text file with one line of text and tried to encrypt it using DES. I used the following command: ... (2 Replies)
Discussion started by: Ultrix
2 Replies

8. Shell Programming and Scripting

Openssl scripting problem

im trying to make sure the openssl password does not show up in the output of ps. so i'm trying to do something like this: MAST=yup echo "U2FsdGVkX19wH9LrQhuRZes45BM9rfiRpdhTCi+gLls=" | openssl <<HERE 2>&1 >/dev/null aes-128-cbc -a -d -salt -k "${MAST}" HERE But this isn't working.. I... (10 Replies)
Discussion started by: SkySmart
10 Replies

9. Solaris

Openssl upgrade

Hello Admins. I need to upgrade the openssl version in Solaris 10 due to vulnerabilities. When I checked the current version, it shows: bash-3.2# openssl version OpenSSL 1.0.2n 7 Dec 2017 bash-3.2# which openssl /usr/bin/openssl When I installed the new one, its getting... (0 Replies)
Discussion started by: snchaudhari2
0 Replies
GRUB-RENDER-LABEL(1)                                               User Commands                                              GRUB-RENDER-LABEL(1)

NAME
grub-render-label - generate a .disk_label for Apple Macs. SYNOPSIS
grub-render-label [OPTION...] [OPTIONS] DESCRIPTION
Render Apple .disk_label. -b, --bgcolor=COLOR use COLOR for background -c, --color=COLOR use COLOR for text -f, --font=FILE use FILE as font (PF2). -i, --input=FILE read text from FILE. -o, --output=FILE set output filename. Default is STDOUT -t, --text=STRING set the label to render -v, --verbose print verbose messages. -?, --help give this help list --usage give a short usage message -V, --version print program version Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. REPORTING BUGS
Report bugs to <bug-grub@gnu.org>. SEE ALSO
The full documentation for grub-render-label is maintained as a Texinfo manual. If the info and grub-render-label programs are properly installed at your site, the command info grub-render-label should give you access to the complete manual. grub-render-label (GRUB) 2.02-2ubuntu8.3 July 2018 GRUB-RENDER-LABEL(1)
All times are GMT -4. The time now is 05:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy