Use OpenSSl comand from API / DLL

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
PedroAlex
Posts: 231
Joined: Tue Feb 09, 2010 3:06 am

Use OpenSSl comand from API / DLL

#1 Post by PedroAlex »

Good afternoon.

I’ m Looking for a solution to create a hash key type Sha1 encoded Base64.
In openssl is done by executing in CMD:

‘openssl dgst sha1-sign Fileprivatekey.pem out Filemessage.sha1 message’
and thain
‘Openssl enc -base64 -in Filemessage.sha1 -out FileMsgb64 –A’

I can do runshell() openssl but I wanted to avoid using external exes and not install openssl on customers PCs.

Any body now some dll or Api that does this type of commands, or know or recommend any api that I can use to do this type of keys?

or what is the Api Openssl Dll to do This kind of hash!??

Any Light or idea, I will Appreciate

Thanks for attention
Best regards.

Pedro.
Pedro Alexandre

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Use OpenSSl comand from API / DLL

#2 Post by Cliff Wiernik »

Look at Crytosys.net. They have two products, cryptosys api and cryptosys pki. The are win32 dll's that are rather easy to use. I used cryptosys api for AES encryption purposes. I think it has the additional items you are looking for in one of the two libraries. Cost is rather inexpensive. $159 each in US dollars. There are different tools but have some overlay. I uses the VB6 examples to create the Win32 dll function wrappers. They also work in a com activex fashion but I prefer to use the straight win32 DLL.

What the dll function calls as you need to have the pass by reference code, @, in the function definition itself, not only in the function call as the pass by reference must be carried forward to the actual Win32 call to get the return variable.

Cliff.

User avatar
PedroAlex
Posts: 231
Joined: Tue Feb 09, 2010 3:06 am

Re: Use OpenSSl comand from API / DLL

#3 Post by PedroAlex »

Cliff. Many Thanks for reply.

Right now I'm trying to run the commands mentioned in the previous post, from the DLL libeay32.dll from openssl.
It's a matter of time and research so I can get it.
It's a toothless that xbase has nothing on this type of tool increasingly important in current times.
If we look at what is free xHarbour Libs have all these and many more.
Surely this issue will be more important in the near future.
My apologies to Roger for presenting this subject in this forum, because it has nothing to do with the title purpose.
Again many thanks to Cliff for the opinion.
I was hoping someone has experience with the API of openssl.
At this point any tip can show me the right way.
I´m Almost there ...

best regards.
Pedro.
Pedro Alexandre

patito
Posts: 121
Joined: Tue Aug 31, 2010 9:01 pm

Re: Use OpenSSl comand from API / DLL

#4 Post by patito »

Hi Pedro

The dll of CryptoSys is excellent.
http://www.cryptosys.net/pki/

Wrapper using ot4xb library of Pablo Botella is free, is not necessary openssl.dll .or libeay32.dll

Best Regard
Hector

Example : wrapper wih ot4xb.dll
#xtranslate HASH_HexFromFile([<params,...>]) =>;
FpQCall({"diCrPKI","HASH_HexFromFile" },"__sl__pt__sl__pt__sl"[,<params>])

// ' Create an SHA-1 digest value in hex format
strDigest = Space (40) //(PKI_SHA1_CHARS)
nLen = HASH_HexFromBytes(@strDigest, Len(strDigest), @strData, Len(strData), 0 ) //PKI_HASH_SHA1)
// ' Display in base64
// ? "SHA1(DA)= esto es importante en base64" , cnvB64StrFromBytes(cnvBytesFromHexStr(strDigest))
// msgbox(cPrintf( "SIG= : %s", strDigest))
return strDigest

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Use OpenSSl comand from API / DLL

#5 Post by Cliff Wiernik »

I also did the wrappers without using Pablos library.

User avatar
PedroAlex
Posts: 231
Joined: Tue Feb 09, 2010 3:06 am

Re: Use OpenSSl comand from API / DLL

#6 Post by PedroAlex »

patito.
many thanks for feedback

I need this to work with openssl.
I have other solutions to work with openssl.
è robust and free.

I have SSL functions that work very well.
Thanks to Phil Idle examples.

But this small example rsa_sign not going well for me, and I do not see why.

cares to take a look.
You may have a different view.
What I want is that the function returns a message signed by the private key in the format sha1.

and than encoded in Base64, but this point I have not problema.

IF anybody can see this rsa.prg sample, maybe can help..

many Thanks in advance.
Thank you.
Pedro
Attachments
Rsa.rar
Rsa.prg
(450.72 KiB) Downloaded 779 times
Pedro Alexandre

patito
Posts: 121
Joined: Tue Aug 31, 2010 9:01 pm

Re: Use OpenSSl comand from API / DLL

#7 Post by patito »

Hi Pedro

If you need this routine for Billing Software Certification , I recommend
lose no time, as you need to know thoroughly the openssl, Bio handling, etc, so its function rsa_sign () fails.
If you are from Portugal, talk to Pablo Botella, sure he can give you the solution.

And the other thing to check this link which has been recommended at you.
http://www.cryptosys.net/pki/portugal_D ... tware.html

Best Regard
Hector

Post Reply