Sponsored Content
Top Forums Shell Programming and Scripting Newby needs help from an OpenSSL expert Post 302683789 by fundidor on Wednesday 8th of August 2012 02:30:58 PM
Old 08-08-2012
[Solved] Newby needs help from an OpenSSL expert

Dear friends,


Thank you for reading this post.

Please download files here: http://www.idanfe.com/dl/files.zip

This is my problem:

I have to sign a file like my teste1.txt

One sample signed file is example.txt

I am also including a private key I generated called private.pem, and its public key: public.pem

Please notice at the end of the example.txt file the string:

EAD4D714CF40A31A2AE3A26A5295082089EC554B51A4B307F044AC84BEC9A34223A11A3B64BE4DB4DE7DDBFF06D3394499A6 A55C74D0AB24343589FCDE9CB0AC989AE451B2C15AFF7689368A16499C67DC9076A69DACCA38A73B4EDCA3ACA15AD06800EE 74CCEB36864C408C0CAB46593774F1979A8345B4327A55C19D1C4D4EEBD

Please notice that the "EAD" is present in all files and is not part of the signature, I have to place the signature as "EAD" + signature.

These are the instructions I have from the standart written by the brazilian taxing department:

---- begins Google translation ----


TECHNICAL DATA FOR THE GENERATION OF DIGITAL SIGNATURE

The digital signature should be generated by the following:

1 - apply the MD5 one-way function only once in the entire file, except for the EAD record. The result is a code of 128 bits or 16 ASCII characters, corresponding to a 32-digit hexadecimal numbers. Should be used in the calculations the hexadecimal number, considering it as a single block;

2 - create a private key of 1024 bits, equivalent to a 256-digit hexadecimal number, known only to the company developing the PAF-ECF;

3 - encrypt the hexadecimal code generated as provided in item 1, using the key referred to in item 2, the RSA public key algorithm;

---- ends google translation -----

(ITEM 1)

I think I have been able to generate item 1 by submitting to shell the following command:

md5 teste1.txt

And as a result I have:

867af78828b9dfdc8cfc52211571399e

I have a GUI tool given to me running under windows to do the job, and it results in:

867AF78828B9DFDC8CFC52211571399E

So, I guess I am correct on item number 1.

(ITEM 2)

I ran this command on shell:


openssl rsa -in private.pem -modulus -out modulo.txt

It resulted me the string:

A01386F3AB113FABC633EE9E95B0E4B5BB1057D3AEFCE7CF859D03FA9B356B902550A6BDFBBA55480CBA99D0C487CE4B7421 4757BBBD596D5B8F41E84E158C110150F42F107FBECFB774F6A8FDF853DE70516BC088F551B020AB9B921A270D8038AB7722 7545FBC28331906FBAEEDD2CC1848455524D874762ABD90128BD60E3

So I think, I have done step 2 so far...


(ITEM 3)

I simply am stuck here, don't know what to do now.

I have a tool running under windows that when I submit my private key and teste1.txt to it, and gives me:

953F2F56387ACBF724A7D6BF565A4FAA274214CBC70190330FD9FED7F65474306A3356E6129444A0971DA561282BC1786FFC 0C968EBB4411053A3265EC6C1A683CDD0D4BD21862A4DB29D4F2B7F628BAC0354F9B04174952287E51CA48993DB3C1292310 AEF0419FD55162B41145A3F77ACFD0FC889E778E0A1A21A661C3786E


Can someone be so kind to help me with this?

How can I obtain the same string using openssl?

I understand I have to use the md5 result from teste1.txt and the modulus result, but have no idea on what command to send to shell.

Thank you for reading this,
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help for a newby

I am new to using nawk. When I put the following line in script file test1.awk I get the results: { print NR, length($0),NF} >nawk -f test1.awk head.txt 1 63 5 2 2622 188 3 2166 155 4 3192 228 5 2679 192 ..... but if I modify the test1.awk file to look like this: BEGIN {FS = ","}... (2 Replies)
Discussion started by: placroix1
2 Replies

2. Solaris

expert vi commands

:) Hi UNIX friends, Where do I get advanced vi commands to practice. Please Help Me. Love (4 Replies)
Discussion started by: Love
4 Replies

3. UNIX for Advanced & Expert Users

Expert Opinion

This perhaps does not belong in ths category; apologies, however, we have a heated debate going and your input will decide the result. Should UNIX (HP, AIX, etc) be rebooted following a monthly cycle (Every month, or a qtr, etc.). We have some UX admins (grumps) who say they have seen a UX... (6 Replies)
Discussion started by: rsheikh
6 Replies

4. Shell Programming and Scripting

Expert cp command

How can I use the cp command to copy every file that I can find inside several folders cp -R *test* folder Supose there is ./122342343teste122343.txt ./bound/123teste1223453.txt ./feed/123teste1223453.txt and i want the files 122342343teste122343.txt, bound/123teste1223453.txt... (12 Replies)
Discussion started by: lipe.82
12 Replies

5. Homework & Coursework Questions

Make file newby question

1. The problem statement, all variables and given/known data: I'm brand new to make files, and I was hoping someone could tell me where I'm messing up. I'm trying to build a cpp program I wrote for class on a linux system, i'm using winscp and puTTy. The program works fine when I build it... (3 Replies)
Discussion started by: Casper3912
3 Replies

6. Solaris

Becoming a Solaris expert?

Hello everyone, how do you really study to become an expert in solaris OS? Thanks (3 Replies)
Discussion started by: cjashu
3 Replies

7. Fedora

Newby: How to actually update software?!

Hi All - 1) I work with bigdate for a living, use lots of neat software, SAS, SQL Server, etc. I know how to get my data and such, analyze it, etc... 2) I use UNIX at work (Solaris mostly) and can easily navigate around Unix and get the job done, vi and sas -nodms are about my fav, and some... (6 Replies)
Discussion started by: sas
6 Replies
All times are GMT -4. The time now is 10:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy