* contrib/hbssl/hbssl.hbp
* contrib/hbssl/hbssl.hbm
* contrib/hbssl/ssl.c
! Implemented special OpenSSL requirement when using OpenSSL
as a .dll under win, for version 0.9.8 and above.
! http://www.openssl.org/support/faq.html#PROG2
; NOTE: SSL_INIT() must be called by the user application
for this to work.
* contrib/hbssl/tests/bio.prg
* contrib/hbssl/tests/encode.prg
* contrib/hbssl/tests/digest.prg
* contrib/hbssl/tests/crypt.prg
* contrib/hbssl/tests/pem.prg
+ Call SSL_INIT()
* contrib/hbssl/pem.c
! PEM_READ_BIO_*() functions fixed to not require a second
parameter (a password callback or string).
* contrib/3rd/sqlite3/sqlite3.c
+ contrib/3rd/sqlite3/sqlite3.dif
* contrib/3rd/sqlite3/sqlite3.hbp
! make sqlite3 work in minix.
Patch by Tamas.
; NOTE: I'd be good to submit this mod upstream. It might
be nasty to rediff this code. [vszakats]
80 lines
1.7 KiB
Plaintext
80 lines
1.7 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
|
|
* www - http://harbour-project.org
|
|
*/
|
|
|
|
#include "simpleio.ch"
|
|
|
|
#include "hbssl.ch"
|
|
|
|
PROCEDURE Main()
|
|
|
|
LOCAL ctx
|
|
LOCAL digest
|
|
|
|
LOCAL key
|
|
LOCAL iv
|
|
|
|
SSL_INIT()
|
|
|
|
OpenSSL_add_all_digests()
|
|
OpenSSL_add_all_ciphers()
|
|
|
|
? "Version built against:", hb_NumToHex( OPENSSL_VERSION() )
|
|
? "Version loaded:", hb_NumToHex( SSLEAY() )
|
|
|
|
ctx := EVP_MD_CTX_create()
|
|
EVP_MD_CTX_init( ctx )
|
|
|
|
EVP_DigestInit_ex( ctx, "SHA256" )
|
|
EVP_DigestUpdate( ctx, "sample text" )
|
|
digest := ""
|
|
EVP_DigestFinal( ctx, @digest )
|
|
? "SHA256", ">" + hb_StrToHex( digest ) + "<"
|
|
|
|
EVP_DigestInit_ex( ctx, HB_EVP_MD_SHA256 )
|
|
EVP_DigestUpdate( ctx, "sample text" )
|
|
digest := ""
|
|
EVP_DigestFinal( ctx, @digest )
|
|
? "SHA256", ">" + hb_StrToHex( digest ) + "<"
|
|
|
|
EVP_MD_CTX_cleanup( ctx )
|
|
|
|
EVP_DigestInit_ex( ctx, HB_EVP_MD_RIPEMD160 )
|
|
EVP_DigestUpdate( ctx, "sample text" )
|
|
digest := ""
|
|
EVP_DigestFinal( ctx, @digest )
|
|
? "RIPEMD160", ">" + hb_StrToHex( digest ) + "<"
|
|
|
|
key := ""
|
|
iv := ""
|
|
? "EVP_BytesToKey", EVP_BytesToKey( HB_EVP_CIPHER_AES_192_OFB, HB_EVP_MD_SHA256, "salt1234", "data", 2, @key, @iv )
|
|
? "KEY", hb_StrToHex( key )
|
|
? ">" + key + "<"
|
|
? "IV", hb_StrToHex( iv )
|
|
? ">" + iv + "<"
|
|
|
|
key := ""
|
|
iv := ""
|
|
? "EVP_BytesToKey", EVP_BytesToKey( "AES-192-OFB", "SHA256", "salt1234", "data", 2, @key, @iv )
|
|
? "KEY", hb_StrToHex( key )
|
|
? ">" + key + "<"
|
|
? "IV", hb_StrToHex( iv )
|
|
? ">" + iv + "<"
|
|
|
|
key := ""
|
|
iv := ""
|
|
? "EVP_BytesToKey", EVP_BytesToKey( "AES-192-OFB", "SHA256",, "data", 2, @key, @iv )
|
|
? "KEY", hb_StrToHex( key )
|
|
? ">" + key + "<"
|
|
? "IV", hb_StrToHex( iv )
|
|
? ">" + iv + "<"
|
|
|
|
EVP_cleanup()
|
|
|
|
RETURN
|