"Nijenhuis, Erwin" wrote: > > If you want to publish it for free put it onto the mailing list. I am > interested too! > > Erwin i'm sorry, but the complete code is "public" as it is viewable for anyone in our rooms, with the only purpose to search for back-door or trojan. Interfacing openssl with vb is simple for many of the crypto-functions (i've not used SSL channels, only key/cert management).
You can use the openssl function directly, but i suggest to insert an intermediate DLL, where you can write code in C/C++ as usual for openssl, achieving your purposes more directly. C Example is in file erase.c attached to this email. After inserting this function in a dll template by VisualC, you can get the dll "erase.dll". Insert into your vb code in a module the following statement: Declare Function eraseFile _ Lib "erase.dll" ( _ ByVal filename As String, _ ByVal error As String _ ) As Integer and now in your vb code you can call the function eraseFile as a Vb function. Note that "error" is interpreted as a return value from the call and MUST be declared as a static string allocating a predefined length. (very bad, i know) In the same manner you can use in your C/C++ code the openssl functions, including the openssl includes and putting the openssl dll in the same dir of your vb executable (on in the windows/system area). Obviously, when you compile the dll, you must be sure that the compiler can reach the include/libs created by openssl.... This way could not be the best, but runs on most of the funcs deployed by openssl... Last but not least, sorry for my poor english. Bye. -- Dott. Sergio Rabellino Technical Staff Department of Computer Science University of Torino (Italy) Member of the Internet Society http://www.di.unito.it/~rabser Tel. +39-0116706701 Fax. +39-011751603
Declare Function eraseFile _ Lib "certtool.dll" ( _ ByVal filename As String, _ ByVal error As String _ ) As Integer /* Rabellino Dr. Sergio - Progetto Firma Elettronica Nome del file: eraseFile.c Descrizione: Cancella un file in modo sicuro dal filesystem Parametri: filename : nome del file error : error management Valori di ritorno: 1 = Normal Termination -1 = Errore generico Release: First Beta on 14.12.1998 Bugs: none */ #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <io.h> int _stdcall eraseFile( BSTR vb_filename, BSTR error) { int filehandle; int count=0; int times; int bytes; /* Try to open the file ... */ filehandle = _open((LPSTR)vb_filename,_O_RDWR | _O_BINARY); if ( filehandle == -1) { sprintf((LPSTR)error,"eraseFile: Impossibile eliminare il file: %s !",(LPSTR)vb_filename); return(-1); } count = _lseek(filehandle, 0L, SEEK_END); for (times = 0 ; times < 255; ++times); { char buf[2]; if(_lseek(filehandle,0L,SEEK_SET)) { sprintf((LPSTR)error,"eraseFile: Errore in fase di rewind del file %s !",(LPSTR)vb_filename); _close(filehandle); return(-1); } buf[0] = times; for(bytes = 0 ; bytes < count ; ++bytes) { _write(filehandle,buf,1); } } _close(filehandle); _unlink((LPSTR)vb_filename); return(0); }