Files
harbour-core/harbour/contrib/hbssl/tests/encode.prg
Viktor Szakats 6d60145620 2012-11-07 03:28 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/hbnf/hbnf.hbx
  * contrib/hbodbc/hbodbc.hbx
  * contrib/hbtip/hbtip.hbx
  * contrib/hbtpathy/hbtpathy.hbx
  * contrib/xhb/xhb.hbx
    ! minor fixes

  * contrib/hblzf/tests/*.prg
  * contrib/hbmxml/format.prg
  * contrib/hbmysql/tests/test.prg
  * contrib/hbmysql/tmysql.prg
  * contrib/hbmysql/tsqlbrw.prg
  * contrib/hbnetio/netiomt.prg
  * contrib/hbnetio/utils/hbnetio/*.prg
  * contrib/hbnf/*.prg
  * contrib/hbnf/tests/*.prg
  * contrib/hbodbc/tests/testodbc.prg
  * contrib/hbodbc/todbc.prg
  * contrib/hbpgsql/tests/*.prg
  * contrib/hbpgsql/tpostgre.prg
  * contrib/hbssl/tests/*.prg
  * contrib/hbtip/*.prg
  * contrib/hbtip/tests/*.prg
  * contrib/hbtpathy/telepath.prg
  * contrib/hbzebra/tests/*.prg
  * contrib/rddads/tests/*.prg
  * contrib/xhb/*.prg
  * contrib/xhb/tests/*.prg
    * formatted
    ! commented code converted to #if 0/#endif block
2012-11-07 02:57:26 +00:00

52 lines
860 B
Plaintext

/*
* $Id$
*/
/*
* Copyright 2009 Viktor Szakats (harbour syenar.net)
* www - http://harbour-project.org
*/
#require "hbssl"
#include "simpleio.ch"
#include "hbssl.ch"
PROCEDURE Main()
LOCAL ctx
LOCAL result
LOCAL encrypted
LOCAL decrypted
SSL_init()
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