* contrib/hbssl/Makefile
+ contrib/hbssl/evppkey.c
* contrib/hbssl/evpciph.c
* contrib/hbssl/hbssl.h
* contrib/hbssl/ssl.c
* contrib/hbssl/sslctx.c
* contrib/hbssl/sslerr.c
* contrib/hbssl/evp.c
* contrib/hbssl/evpmd.c
* contrib/hbssl/evpenc.c
* contrib/hbssl/tests/digest.prg
+ contrib/hbssl/tests/encode.prg
* SSL_ERR_*() functions renamed to ERR_*() to have
the exact same name as in OpenSSL.
! Minor fixes and cleanups.
+ Added:
OPENSSL_VERSION()
SSLEAY()
SSL_USE_PRIVATEKEY()
SSL_CTX_USE_PRIVATEKEY()
EVP_SIGNFINAL()
EVP_VERIFYFINAL()
EVP_PKEY_NEW()
EVP_PKEY_TYPE()
EVP_PKEY_SIZE()
EVP_PKEY_BITS()
EVP_PKEY_ASSIGN()
EVP_PKEY_ASSIGN_RSA()
EVP_PKEY_ASSIGN_DSA()
EVP_PKEY_ASSIGN_DH()
EVP_BYTESTOKEY()
ERR_LOAD_EVP_STRINGS()
+ Added OpenSSLs own BASE64 functions:
HB_EVP_ENCODE_CTX_CREATE()
EVP_ENCODEINIT()
EVP_ENCODEUPDATE()
EVP_ENCODEFINAL()
EVP_DECODEINIT()
EVP_DECODEUPDATE()
EVP_DECODEFINAL()
50 lines
857 B
Plaintext
50 lines
857 B
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
|
|
* www - http://www.harbour-project.org
|
|
*/
|
|
|
|
#include "simpleio.ch"
|
|
|
|
#include "hbssl.ch"
|
|
|
|
PROCEDURE Main()
|
|
|
|
LOCAL ctx
|
|
LOCAL result
|
|
LOCAL encrypted
|
|
LOCAL decrypted
|
|
|
|
LOCAL cKey := "key"
|
|
|
|
OpenSSL_add_all_ciphers()
|
|
|
|
ctx := hb_EVP_ENCODE_CTX_create()
|
|
|
|
EVP_EncodeInit( ctx )
|
|
|
|
encrypted := ""
|
|
result := ""
|
|
EVP_EncodeUpdate( ctx, @result, "sample text" )
|
|
encrypted += result
|
|
EVP_EncodeFinal( ctx, @result )
|
|
encrypted += result
|
|
? "ENCRYTPTED", ">" + encrypted + "<"
|
|
|
|
ctx := hb_EVP_ENCODE_CTX_create()
|
|
|
|
EVP_DecodeInit( ctx )
|
|
|
|
decrypted := ""
|
|
result := ""
|
|
EVP_DecodeUpdate( ctx, @result, encrypted )
|
|
decrypted += result
|
|
EVP_DecodeFinal( ctx, @result )
|
|
decrypted += result
|
|
? "DECRYTPTED", ">" + decrypted + "<"
|
|
|
|
RETURN
|