RE: [Botan-devel] TripleDES /ECB Mode
Brought to you by:
randombit
|
From: JnMlMe <jn...@fr...> - 2004-09-07 09:03:29
|
Hi
First, thanks for your very useful help.
I go forward in the process, but now, i have a problem during the
compilation project:
------ Rebuild All started: Project: DES, Configuration: Debug Win32 =
------
=20
Deleting intermediate files and output files for project 'DES',
configuration 'Debug|Win32'.
Compiling...
3des.cpp
Linking...
LINK : error LNK2020: unresolved token (0A00002E) _DebugHeapTag LINK : =
fatal
error LNK1120: 1 unresolved externals
=20
Build log was saved at " <file:///d:\Dev\Des\Des\Debug\BuildLog.htm>
file://d:\Dev\Des\Des\Debug\BuildLog.htm"
DES - 2 error(s), 0 warning(s)
=20
=20
---------------------- Done ----------------------
=20
Rebuild All: 0 succeeded, 1 failed, 0 skipped
=20
=20
I m using VS 2003.NET.
Here is the command line for the compiler:
/Od /I "D:\DEV\BOTAN\include" /AI "D:\DEV\DES\Debug" /D "WIN32" /D =
"_DEBUG"
/D "_MBCS" /FD /EHsc /MTd /GS /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 =
/nologo /c
/Zi /clr /TP
=20
Here, the command line for the linker:
/OUT:"D:\DEV\DES\Debug\DES.exe" /INCREMENTAL:NO /NOLOGO
/LIBPATH:"D:\DEV\BOTAN" /NODEFAULTLIB:"LIBC" /NODEFAULTLIB:"libcpmtd" =
/DEBUG
/ASSEMBLYDEBUG /PDB:"D:\DEV\DES\Debug/DES.pdb" /FIXED:No libbotan.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
=20
As you can see, I have ignore specific librairies : LIBC and libcpmtd.
=20
Have you an idea ?
Thks
JM
=20
=20
=20
-----Message d'origine-----
De : ope...@li...
[mailto:ope...@li...] De la part de Jack =
Lloyd
Envoy=E9 : mardi 7 septembre 2004 03:28
=C0 : ope...@li...
Objet : Re: [Botan-devel] TripleDES /ECB Mode
=20
On Mon, Sep 06, 2004 at 03:46:52PM +0200, JnMlMe wrote:
> Hi,
>=20
> I need to decrypt a string who was encrypted with Triple DES (ECB =
Mode)
> under SUN Solaris.
>=20
> First, I would like to compile Botan under Windows 2K environment.
> I have a problem when i process the nmake command :
>=20
> =20
>=20
> D:\botan>perl configure.pl msvc-windows-i586 --module-set=3Dwin32
[...]
>=20
> CL /nologo -Iinclude /O2 /G5 /GX /GR /D_CONSOLE /c
src\adler32.cpp
> /Fob
> uild\lib\adler32.obj
> 'CL' n'est pas reconnu en tant que commande interne
> ou externe, un programme ex=E9cutable ou un fichier de commandes.
> NMAKE : fatal error U1077: 'CL' : return code '0x1'
> Stop.
=20
It looks like cl, the command line version of the compiler, isn't in =
your
PATH
variable. Have you tried using the command shell that comes with Visual
Studio?
Running that will automatically set up your environment with the right
variables for using the compiler and linker from the command line. =
Otherwise
you'll have to find where the CL binary is installed, and add that =
directory
to
PATH.
=20
> Second point, i have looked the encrypt and decrypt cpp examples =
files.
>=20
> These files used the CBC mode.
> Should i only changed the mode with ECB in line 117 ?
>=20
=20
No -- the examples are doing password hashing, message authentication, =
and
similiar things that you probably don't want to do. Well, you do want to =
do
them normally, for decent security, but in this case you won't be able =
to
decrypt the message trying to use them, so there is not much point.
=20
The following should start you off, but I don't know how the key is =
derived,
so
as-is it won't work (because currently the key is zero-length, which =
3DES
doesn't take). If you know the hex value of the key, just assign it to =
the
key variable (SymmetricKey key =3D "01234[...]").
=20
----- FILE ------
=20
#include <botan/botan.h>
using namespace Botan;
=20
int main(int argc, char* argv[])
{
try {
if(argc !=3D 2)
{
std::cout << "Usage: " << argv[0] << " input_file" << =
std::endl;
return 1;
}
=20
LibraryInitializer init;
=20
SymmetricKey key; // fill this in with whatever key you have
=20
Pipe pipe(get_cipher("TripleDES/ECB/NoPadding", key, DECRYPTION));
=20
DataSource_Stream input(argv[1]);
pipe.process_msg(input);
std::cout << pipe.read_all_as_string();
}
catch(std::exception& e)
{
std::cout << "Error: " << e.what() << std::endl;
return 1;
}
return 0;
}
=20
----- /FILE ------
=20
=20
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=3D5047&alloc_id=3D10808&op=3Dclick
--=20
opencl-devel mailing list
https://lists.sourceforge.net/lists/listinfo/opencl-devel
|