RE: Openssl ca application

2012-09-20 Thread Dave Thompson
>From: owner-openssl-us...@openssl.org On Behalf Of James Burton
>Sent: Tuesday, 18 September, 2012 15:15

>Can you tell me what I am doing wrong , I am build a window application (
.exe )
>and I got this error:
>ign>cl.exe sign.c 
>Microsoft (R) C/C++ Optimizing Compiler Version 17.00.50727.1 for x64 
>Copyright (C) Microsoft Corporation.  All rights reserved. 
>
>sign.c 
>Microsoft (R) Incremental Linker Version 11.00.50727.1 
>Copyright (C) Microsoft Corporation.  All rights reserved. 
>   
>/out:sign.exe 
>sign.obj 
>sign.obj : error LNK2019: unresolved external symbol EVP_DigestUpdate
referenced 

>sign.exe : fatal error LNK1120: 11 unresolved externals 

In order to use any C library, you must tell the linker about it.
In some cases, including MSVC++ TTBOMK, you can get the compiler 
to tell the linker for you; other cases you must do it yourself.
For the C standard-library in MSVC++ (LIBC* or MSVCR*) the compiler 
actually hides this in the .obj file(s) and you don't see it.

Since your compiler (cl) seemingly found the openssl includes, you 
apparently have INCLUDEPATH set correctly. If you also have LIBPATH 
set correctly, putting the bare library name(s) on the cl command 
line (after the name of all C source files to be compiled and any 
separate object files to be linked) should be enough.

For a Windows build of OpenSSL the library names are canonically 
ssleay32.lib and libeay32.lib; for the routines referenced by this 
program you only need libeay. For a program using only SSL_* routines 
if dynamically linked you need only ssleay32.lib; for dynamic linking 
the .lib is only an "import" library that causes the real library in 
the .dll to be loaded at runtime, when both .dll's must be in the DLL 
search order, which once upon a time was just dot and PATH, but MS 
has been changing it as a result of various dll-planting attacks 
and I am not confident what it is now except that almost certainly 
%windir%\system32 still works (changing that would break far too much.
For static linking of SSL_* you need ssleay and libeay in that order.

PS- I assume you know openssl commandline already provides a good deal 
of cert-signing functionality in the 'ca', 'x509', and 'req' utilities.
If one of these does what you want, you don't need to write your own 
program, unless you want to.


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


RE: Openssl ca application

2012-09-20 Thread James Burton

Hello
 
Can you tell me what I am doing wrong , I am build a window application ( .exe )
 
 
and I got this error:
 
ign>cl.exe sign.c 
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.50727.1 for x64 
Copyright (C) Microsoft Corporation.  All rights reserved. 

sign.c 
Microsoft (R) Incremental Linker Version 11.00.50727.1 
Copyright (C) Microsoft Corporation.  All rights reserved. 

/out:sign.exe 
sign.obj 
sign.obj : error LNK2019: unresolved external symbol EVP_DigestUpdate 
referenced 
 in function main 
sign.obj : error LNK2019: unresolved external symbol EVP_DigestInit referenced 
i 
n function main 
sign.obj : error LNK2019: unresolved external symbol EVP_SignFinal referenced 
in 
 function main 
sign.obj : error LNK2019: unresolved external symbol EVP_VerifyFinal referenced 
in function main 
sign.obj : error LNK2019: unresolved external symbol EVP_sha1 referenced in 
func 
tion main 
sign.obj : error LNK2019: unresolved external symbol EVP_PKEY_free referenced 
in 
 function main 
sign.obj : error LNK2019: unresolved external symbol X509_get_pubkey referenced 
in function main 
sign.obj : error LNK2019: unresolved external symbol ERR_print_errors_fp 
referen 
ced in function main 
sign.obj : error LNK2019: unresolved external symbol ERR_load_crypto_strings 
ref 
erenced in function main 
sign.obj : error LNK2019: unresolved external symbol PEM_read_X509 referenced 
in 
 function main 
sign.obj : error LNK2019: unresolved external symbol PEM_read_PrivateKey 
referen 
ced in function main 
sign.exe : fatal error LNK1120: 11 unresolved externals 
 
 
Thank you
 
From
 
James Burton