About contents of Generated RSA-1024 bit key pair in one code.

437 views
Skip to first unread message

Gary

unread,
Feb 21, 2009, 11:34:46 AM2/21/09
to Crypto++ Users
Hi Dear all!

I'm using Visual C++ 2008 and "CryptoPP 5.5.2" version!

I've downloaded 5 programs of link:"http://www.cryptopp.com/wiki/RSA"
and built all 5 programs successfully!

Now my questions:(I have two questions!)

The "RSAKeyGen" program is as below:

#include "stdafx.h"

// Crypto++ Includes
#include "rsa.h"
#include "osrng.h" // PRNG
#include "hex.h" // Hex Encoder/Decoder
#include "files.h" // File Source and Sink

int main(int argc, char* argv[])
{
try
{
std::string PrivateKeyFile = "key.pv";
std::string PublicKeyFile = "key.pb";

CryptoPP::AutoSeededRandomPool rng;

// Specify 1024 bit modulus, accept e = 17
CryptoPP::RSAES_OAEP_SHA_Decryptor Decryptor( rng, 1024 /*, e
*/ );
CryptoPP::HexEncoder privFile(new
CryptoPP::FileSink( PrivateKeyFile.c_str() )
); // Hex Encoder

Decryptor.DEREncode(privFile);
privFile.MessageEnd();

CryptoPP:: RSAES_OAEP_SHA_Encryptor Encryptor(Decryptor);
CryptoPP::HexEncoder pubFile(new
CryptoPP::FileSink( PublicKeyFile.c_str() )
); // Hex Encoder
Encryptor.DEREncode(pubFile);
pubFile.MessageEnd();
}

catch( CryptoPP::Exception& e ) {
std::cerr << "Error: " << e.what() << std::endl;
}

catch (...) {
std::cerr << "Unknown Error" << std::endl;
}

return 0;
}

Which stores Genereted keys in two files named: "key.pv" and
"key.pb"!
The contents of "key.pb" are as following:

Public key:160 bytes

30819D300D06092A864886F70D010101050003818B0030818702818100EA0E48FC0238A432E2F0316940488C4FC

A9A809919D290CDCBAF1020B1CD0ED2B9872C0A96D1746CDDC96F607A36F60E11745281DADB9BB2D8C8B1DABEDF

95453AC6E1F5EF498EAB3588E78885B515BB01A172FEF67990FD8E756184AB80E105BE4D8341BA58F8259D46A14

8AE03FCD2A26EB79AD0B4460D2F39D6428C47B1B3020111

And the contents of "key.pv" are as following:

Private key:633 bytes

30820275020100300D06092A864886F70D01010105000482025F3082025B02010002818100EA0E48FC0238A432E
2F0316940488C4FCA9A809919D290CDCBAF1020B1CD0ED2B9872C0A96D1746CDDC96F607A36F60E11745281DADB
9BB2D8C8B1DABEDF95453AC6E1F5EF498EAB3588E78885B515BB01A172FEF67990FD8E756184AB80E105BE4D834
1BA58F8259D46A148AE03FCD2A26EB79AD0B4460D2F39D6428C47B1B302011102818037126B86971C62DECBFC47
DC8798997C2FABE205E7F54F3F7B384007B15D6CE649C573C6419AB1FB7F7AB0CB680CEE99E5FD40970651CA483
3020BBAFFBC231EE5DF7421B4D88F6D01A0806087E3C340689BCCFEB122F2664878865CCEC92457ED337535907A
F5F1B315336023BB54E3D721957E1A402E491BC90DE904B8F631024100ED09DA71F8201D075907CC28ED3BAD8F4
87364E33678A108DE1F347CC1B74B412154F85D02B6EF8084BC9A77EF76F90B6DE2F124A7D19753768CB850551B
8FC9024100FCC759F4B69110149596F9C556F16A59FC97E6E14F2C69C1FC55F1FD7AF2BB4EECDDD8C111977361D
F6FEC7826B0DAFEE23D0B1E3951EA030296A2D3E31A0B9B024100A7523FD7FA71056E9932AE3B01CFC5CE8D7EA1
9153A071ABE81606EEA6DBBCA671E1A041A7903096F448E581D635DCF90245D7652B2A88EF9EF9EB83FFD738510
24100A3900D07C16CEC498DF84743747E17A3A37159286068083239DD423A9AD94C05E48F8C40B107A503181B3E
A81909062C74459DC8433500D4C570877A0B6B34AF02401BDD44E289A063382A7ABBD854737F6FDF17EC35B8E0B
40F8F1DD296A5D5C0D62B271FF77EF2AAD58335D1BD43CB43ACF35801081FA89023BDC933CE82759ACC


My first question is that why key files contents are as above,whereas
in the code defined 1024 bits(128 bytes) for modulus n?
Why does "key.pv" contain 633 bytes?!
And which part is n and wich part is d?



My second question:
Because I want to generate key pair and locate them in two byte
arrays, I used of "ArraySink" instead of "FileSink" and changed the
above code as below:


#include "stdafx.h"

// Crypto++ Includes
#include "rsa.h"
#include "osrng.h" // PRNG
#include "hex.h" // Hex Encoder/Decoder
#include "files.h" // File Source and Sink
#include "filters.h" //Array Source and Sink

int main(int argc, char* argv[])
{
try
{
byte* privatekey;
byte* publickey;
//std::string PrivateKeyFile = "key.pv";
//std::string PublicKeyFile = "key.pb";

CryptoPP::AutoSeededRandomPool rng;

// Specify 512 bit modulus, accept e = 17
CryptoPP::RSAES_OAEP_SHA_Decryptor Decryptor( rng, 512 /*, e
*/ );
CryptoPP::HexEncoder privArray(new
CryptoPP::ArraySink(privatekey,sizeof(privatekey))
); // Hex Encoder

Decryptor.DEREncode(privArray);
privArray.MessageEnd();

CryptoPP:: RSAES_OAEP_SHA_Encryptor Encryptor(Decryptor);
CryptoPP::HexEncoder pubArray(new
CryptoPP::ArraySink( publickey, sizeof(publickey))
); // Hex Encoder
Encryptor.DEREncode(pubArray);
pubArray.MessageEnd();

}

catch( CryptoPP::Exception& e ) {
std::cerr << "Error: " << e.what() << std::endl;

}

catch (...) {
std::cerr << "Unknown Error" << std::endl;
}

return 0;
}

After compile,I got this output:(3 warnings and 0 error!)

------ Build started: Project: RSAKeyGen, Configuration: Debug Win32
------
Compiling...
RSAKeyGen.cpp
d:\rsakeygen.cpp(26) : warning C4700: uninitialized local variable
'privatekey' used
d:\rsakeygen.cpp(34) : warning C4700: uninitialized local variable
'publickey' used

Linking...
RSAKeyGen.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/
INCREMENTAL:NO'

RSAKeyGen - 0 error(s), 3 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped
==========

But after running it's .exe file,I got runtime error!

I want to show the contents of two key arrays in output and can use
of their contents, but I don't know what should I do?
Which section of the changed code is wrong and how can I see the
contents of arrays and use
or manipulate them?

I'll greatly appreciate you, if help me;
I need so help!

Thank you
Gary

Geoff Beier

unread,
Feb 21, 2009, 2:23:04 PM2/21/09
to Gary, Crypto++ Users
> My first question is that why key files contents are as above,whereas
> in the code defined 1024 bits(128 bytes) for modulus n?
> Why does "key.pv" contain 633 bytes?!
> And which part is n and wich part is d?
>
Because the key files are hex encoded and contain more than just the
modulus. The public key is a DER-encoded subjectPublicKeyInfo
structure. See RFC 5280 for the structure and RFC 3279 for the
RSA-specific contents.

The private key file is a DER-encoded PKCS#8 PrivateKeyInfo structure.
The format of the PrivateKey field in that structure is RSAPrivateKey,
as defined in PKCS#1. The definition of both of those is available
from RSA here:
http://www.rsa.com/rsalabs/node.asp?id=2124
in the PKCS#8 and PKCS#1 ASN.1 modules, respectively.

>
>
> My second question:
> Because I want to generate key pair and locate them in two byte
> arrays, I used of "ArraySink" instead of "FileSink" and changed the
> above code as below:
>
>

Look here:

> byte* privatekey;
> byte* publickey;

and here:


> CryptoPP::HexEncoder privArray(new
> CryptoPP::ArraySink(privatekey,sizeof(privatekey))
> ); // Hex Encoder
>

sizeof(privatekey) is sizeof(byte *). That''s a problem when you then
tell crypto++ to copy more than sizeof(byte *) into the array :-).

Hope that helps,

Geoff

Ho

Jeffrey Walton

unread,
Feb 21, 2009, 5:58:27 PM2/21/09
to Crypto++ Users
Hi Geoff,

This question seems to crop up every now and again, so it has been
added to the wiki. I hope you don't mind. http://www.cryptopp.com/wiki/RSA_Cryptography#Key_Encoding

Jeff

Gary

unread,
Feb 22, 2009, 2:48:32 AM2/22/09
to Crypto++ Users
Hi dear Jeff and Geoff!
I read RFC5280 for subjectPublicKeyInfo structure and found it as
below:

SubjectPublicKeyInfo ::= SEQUENCE {
algorithm AlgorithmIdentifier,
subjectPublicKey BIT STRING }

Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension

Extension ::= SEQUENCE {
extnID OBJECT IDENTIFIER,
critical BOOLEAN DEFAULT FALSE,
extnValue OCTET STRING
-- contains the DER encoding of an ASN.1 value
-- corresponding to the extension type identified
-- by extnID
}


And PrivateKeyInfo as below:

PrivateKeyInfo ::= SEQUENCE {
version Version,
privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
privateKey PrivateKey,
attributes [0] IMPLICIT Attributes OPTIONAL }
Version ::= INTEGER
PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
PrivateKey ::= OCTET STRING
Attributes ::= SET OF Attribute

But I can't understand which part of public or private key is "n" and
which part of private key is "d" and which part of public key is "e"
yet!

What I want, is that generate 128 bytes(Hex bytes) for n(modulus) and
128 bytes for d(private exponent)
and store them into two byte array!
In the below command,default value for e(public exponent) is 17:

// Specify 1024 bit modulus, accept e = 17
CryptoPP::RSAES_OAEP_SHA_Decryptor Decryptor( rng, 1024 /*, e
*/ );
and I accepted it!

I want to use this code(generating keypair) in my project and store
them into two "just 256 length" byte array in Hex form(e.g 0x2d,
0x56,...) and need to know which part is exactly n(128 bytes) and
which part is exactly d(128 bytes) and which part is exactly e!
Could you help me about this?
Unfortunately,I don't have any time for complete studying.

How can I achieve this purpose?
I've spent much time on it ,I only should work with sample codes which
are built successfully!

One other request!
Have you any successfully built sample codes of hashing data with SHA1
algorithm?
Sample codes in "Crypto++ user's guide" don't match with "CryptoPP
5.5.2" version and couldn't help me at all ,so I need a sample code
of hashing data with SHA1 algorithm which stores the digest in a byte
array that will be compiled successfully such examples on this page:
http://www.cryptopp.com/wiki/RSA_Cryptography#Key_Encoding

Any help will be greatly appreciated!
I need so help, please help me!
Gary
On Feb 22, 1:58 am, Jeffrey Walton <noloa...@gmail.com> wrote:
> Hi Geoff,
>
> This question seems to crop up every now and again, so it has been
> added to the wiki. I hope you don't mind.http://www.cryptopp.com/wiki/RSA_Cryptography#Key_Encoding

Geoff Beier

unread,
Feb 22, 2009, 4:31:48 PM2/22/09
to Gary, Crypto++ Users
On Sun, Feb 22, 2009 at 02:48, Gary <b.rost...@gmail.com> wrote:
> I read RFC5280 for subjectPublicKeyInfo structure and found it as
> below:
>
> SubjectPublicKeyInfo ::= SEQUENCE {
> algorithm AlgorithmIdentifier,
> subjectPublicKey BIT STRING }
>

That's the structure that's encoded to the file. It's used for many
different algorithms, not just RSA. The RSA-specific parts can be
found in RFC 3279, where they define the contents of the
subjectPublicKey field's BIT STRING.

>
> And PrivateKeyInfo as below:
>
> PrivateKeyInfo ::= SEQUENCE {
> version Version,
> privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
> privateKey PrivateKey,
> attributes [0] IMPLICIT Attributes OPTIONAL }
> Version ::= INTEGER
> PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
> PrivateKey ::= OCTET STRING
> Attributes ::= SET OF Attribute
>
> But I can't understand which part of public or private key is "n" and
> which part of private key is "d" and which part of public key is "e"
> yet!

Likewise, that's the structure that's encoded into the private key
file. As with the SubjectPublicKeyInfo structure, it too can be used
for different algorithms, not only RSA. The private key is in the
PrivateKey field of PrivateKeyInfo. That, for RSA is a RSAPrivateKey
structure as defined by PKCS#1. Look at PKCS#1's asn.1 module (on the
RSA site I linked earlier) to see the ordering of the fields.

>
> What I want, is that generate 128 bytes(Hex bytes) for n(modulus) and
> 128 bytes for d(private exponent)
> and store them into two byte array!

Look at the dump keys sample on the RSA wiki page Jeff linked for you.
When you retrieve the fields, instead of sending them to an ostream as
that sample does, let the CryptoPP::Integer objects encode themselves
into byte arrays:

http://www.cryptopp.com/docs/ref/class_integer.html

> One other request!
> Have you any successfully built sample codes of hashing data with SHA1
> algorithm?
> Sample codes in "Crypto++ user's guide" don't match with "CryptoPP
> 5.5.2" version and couldn't help me at all ,so I need a sample code
> of hashing data with SHA1 algorithm which stores the digest in a byte
> array that will be compiled successfully such examples on this page:
> http://www.cryptopp.com/wiki/RSA_Cryptography#Key_Encoding
>

Here's a trivial example calculates a SHA1 digest over a file, writes
that digest into a byte array, then hex encodes that byte array and
prints it to standard output. Use it for whatever you want, including
transer to the wiki :-)

http://cryptopp.pastebin.com/f4a986357

Good luck.

Geoff

Geoff Beier

unread,
Feb 22, 2009, 11:43:32 PM2/22/09
to Crypto++ Users
On Sun, Feb 22, 2009 at 16:31, Geoff Beier <geoff...@gmail.com> wrote:
>
> http://cryptopp.pastebin.com/f4a986357
>

Sorry to reply to my own post, but I just noticed that someone had
posted a question as an edit to the code in the pastebin, and I wanted
to redirect the follow-up discussion here, since most of us won't
notice things added to the pastebin unless they're called out on this
list :-)

A user with the handle Dio asked:
20 + @What is SecByteBlock means?@
21 + @SecByteBlock outbuf(sha.DigestSize());@

SecByteBlock is defined in the cryptopp header secblock.h. Read there
for full details of what it's good for. Here, I'm just using it as a
convenient smart pointer to a byte array. Others may want to correct
me, but offhand I'd say that every occasion I can think of where I'd
want to use a byte array with a crypto++ interface, it's safer/more
convenient to use a SecByteBlock.


Geoff

Gary

unread,
Feb 23, 2009, 4:13:30 AM2/23/09
to Crypto++ Users
Hi all.

And Thank you Dear Geoff!

I compiled the code you introduced me that was as following:

#include "secblock.h"
#include "files.h"
#include "sha.h"
#include "hex.h"

#include <iostream>

using namespace std;
using namespace CryptoPP;
int main(int argc, char** argv)
{
try {
if(argc < 2){
cerr << "Usage: " << argv[0] << " file" << endl;
return 1;
}
SHA1 sha;
SecByteBlock outbuf(sha.DigestSize());
FileSource hasher(argv[1], true, new HashFilter(sha,new ArraySink

(outbuf,outbuf.size())));
cout << "SHA1(" << argv[1] << "): ";
HexEncoder(new FileSink(cout)).Put(outbuf,outbuf.size());
cout << endl;
} catch(std::exception &e) {
cerr << "Caught an exception: " << e.what() << endl;
return 1;
}
return 0;
}



But I got 77 link errors as the following:

------ Build started: Project: Hash-SHA1, Configuration: Debug Win32
------
Compiling...
1.cpp
Linking...
1.obj : error LNK2019: unresolved external symbol "public: virtual
void __thiscall CryptoPP::Filter::Detach(class
CryptoPP::BufferedTransformation *)" (?
Detach@Filter@CryptoPP@@UAEXPAVBufferedTransformation@2@@Z) referenced
in function "public: __thiscall CryptoPP::HashFilter::HashFilter(class
CryptoPP::HashTransformation &,class
CryptoPP::BufferedTransformation *,bool,int)" (??
0HashFilter@CryptoPP@@QAE@AAVHashTransformation@1@PAVBufferedTransformation@1@_NH@Z)

1.obj : error LNK2001: unresolved external symbol "public: virtual
unsigned int __thiscall CryptoPP::HashFilter::Put2(unsigned char const
*,unsigned int,int,bool)" (?Put2@HashFilter@CryptoPP@@UAEIPBEIH_N@Z)

1.obj : error LNK2001: unresolved external symbol "public: virtual
void __thiscall CryptoPP::HashFilter::IsolatedInitialize(class
CryptoPP::NameValuePairs const &)" (?
IsolatedInitialize@HashFilter@CryptoPP@@UAEXABVNameValuePairs@2@@Z)

1.obj : error LNK2001: unresolved external symbol "public: virtual
void __thiscall CryptoPP::Filter::Initialize(class
CryptoPP::NameValuePairs const &,int)" (?
Initialize@Filter@CryptoPP@@UAEXABVNameValuePairs@2@H@Z)

1.obj : error LNK2001: unresolved external symbol "public: virtual
bool __thiscall CryptoPP::Filter::Flush(bool,int,bool)" (?
Flush@Filter@CryptoPP@@UAE_N_NH0@Z)

1.obj : error LNK2001: unresolved external symbol "public: virtual
bool __thiscall CryptoPP::Filter::MessageSeriesEnd(int,bool)" (?
MessageSeriesEnd@Filter@CryptoPP@@UAE_NH_N@Z)

1.obj : error LNK2001: unresolved external symbol "public: virtual
unsigned __int64 __thiscall
CryptoPP::BufferedTransformation::MaxRetrievable(void)const
MaxRetrievable@BufferedTransformation@CryptoPP@@UBE_KXZ)
.
.
.

D:\Hash-SHA1.exe : fatal error LNK1120: 76 unresolved externals

Hash-SHA1 - 77 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========


Then I changed the above code to a simpler form as below:

#include "secblock.h"
#include "filters.h"
#include "sha.h"
#include "hex.h"

#include <iostream>
using namespace std;
using namespace CryptoPP;

int main()
{
SHA1 sha;
string sData ="Test Message";

byte abDigest[SHA1::DIGESTSIZE];

StringSource(sData, true,
new HashFilter(sha,
new ArraySink(abDigest, sizeof(abDigest))));

HexEncoder(new ArraySink(abDigest, sizeof(abDigest)));

for(int i=0;i<sizeof(abDigest);i++)
cout << "SHA1 value" << abDigest[i]<<" | ";
cout << endl;

return 0;
}


And after compiling it,I got 72 link errors as below again:

------ Build started: Project: Hash-SHA1, Configuration: Debug Win32
------
Compiling...
1.cpp
Linking...
1.obj : error LNK2019: unresolved external symbol "public: virtual
void __thiscall CryptoPP::Filter::Detach(class
CryptoPP::BufferedTransformation *)" (?
Detach@Filter@CryptoPP@@UAEXPAVBufferedTransformation@2@@Z) referenced
in function "public: __thiscall CryptoPP::HashFilter::HashFilter(class
CryptoPP::HashTransformation &,class CryptoPP::BufferedTransformation
*,bool,int)" (??
0HashFilter@CryptoPP@@QAE@AAVHashTransformation@1@PAVBufferedTransformation@1@_NH@Z)

1.obj : error LNK2001: unresolved external symbol "public: virtual
unsigned int __thiscall CryptoPP::HashFilter::Put2(unsigned char const
*,unsigned int,int,bool)" (?Put2@HashFilter@CryptoPP@@UAEIPBEIH_N@Z)

1.obj : error LNK2001: unresolved external symbol "public: virtual
void __thiscall CryptoPP::HashFilter::IsolatedInitialize(class
CryptoPP::NameValuePairs const &)" (?
IsolatedInitialize@HashFilter@CryptoPP@@UAEXABVNameValuePairs@2@@Z)

1.obj : error LNK2001: unresolved external symbol "public: virtual
void __thiscall CryptoPP::Filter::Initialize(class
CryptoPP::NameValuePairs const &,int)" (?
Initialize@Filter@CryptoPP@@UAEXABVNameValuePairs@2@H@Z)

1.obj : error LNK2001: unresolved external symbol "public: virtual
bool __thiscall CryptoPP::Filter::Flush(bool,int,bool)" (?
Flush@Filter@CryptoPP@@UAE_N_NH0@Z)

1.obj : error LNK2001: unresolved external symbol "public: virtual
bool __thiscall CryptoPP::Filter::MessageSeriesEnd(int,bool)" (?
MessageSeriesEnd@Filter@CryptoPP@@UAE_NH_N@Z)

1.obj : error LNK2001: unresolved external symbol "public: virtual
unsigned __int64 __thiscall
CryptoPP::BufferedTransformation::MaxRetrievable(void)const " (?
MaxRetrievable@BufferedTransformation@CryptoPP@@UBE_KXZ)

1.obj : error LNK2001: unresolved external symbol "public: virtual
bool __thiscall CryptoPP::BufferedTransformation::AnyRetrievable(void)
const " (?
AnyRetrievable@BufferedTransformation@CryptoPP@@UBE_NXZ)
.
.
.

D:\Hash-SHA1.exe : fatal error LNK1120: 71 unresolved externals

Hash-SHA1 - 72 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========


I have read the below article at "Codeproject.com" site:
"attachment:/1/CryptoPPIntegration.htm"

And there are details about "2019" and "2001" link errors in it such
below:


Link Error 2019 When Using the FIPS DLL

This error is due to the FIPS DLL only exporting certified algorithms
such as AES. Wei offers two solutions to the issue. First, you can
statically link against the library.
Second, you must use the DLL version of the library (not the FIPS
DLL). Then, to export the missing classes of interest, add the
CRYPTOPP_DLL macro to the class declaration. Then
rebuild the DLL-Import project.

Link Error 2001

The Crypto++ output libraries are located at Win32\output\debug
\cryptlib.lib and Win32 \output\release\cryptlib.lib. The DLL and its
export library are in Win32\dll_output. Note the "dll_" in the path
name. Verify that you are using the correct paths.



I have added the "CryptoPP" library to my visual studio environment
with the below instructions respectively and have built some sample
codes with these instructions succesfully:

1.Rename the library file from cryptlib.lib to cryptlibd.lib (notice
the addition of the "d" for Debug).

2.Move the Debug Library to the location of the Header and Source
Files. Also, move (without renaming) the Release version to the same
folder.

3-Add the location of the Header Files, Source Files, and Libraries to
the VC++ Environment. Select Tools | Options, Directories Tab.

4- Add the location of the Header Files, Source Files, and Libraries
to the VC++ Project.


But I don't know what is this problem from?


BTW,I already had compiled one sample code of hashig data with some
algorithms including SHA1 and had gotten the same link errors!

Really,why do I face these link errors?

Help me please!

Best Regards.
Gary.

On Feb 23, 7:43 am, Geoff Beier <geoffbe...@gmail.com> wrote:

Geoff Beier

unread,
Feb 24, 2009, 12:26:45 AM2/24/09
to Gary, Crypto++ Users

I think this is a problem in your environment. I built crypto++ in
/Users/gbeier/scratch/cryptopp552 and created my test program in
/Users/gbeier/scratch/hashtest/hashtest.cc with the contents you give
above. Then I used GNUMake to build the program (from within my
hashtest directory) as follows:

$ env CXXFLAGS="-I/Users/gbeier/scratch/cryptopp552"
LDFLAGS="-L/Users/gbeier/scratch/cryptopp552 -lcryptopp" make hashtest

That completes without errors, and when I run the program I get:
$ ./hashtest hashtest.cc
SHA1(hashtest.cc): E7B96076EE846AE1D4D3CDE80078EC716A5A9EAB

For comparison, when I hash the same file using OpenSSL, I see:
$ openssl sha1 hashtest.cc
SHA1(hashtest.cc)= e7b96076ee846ae1d4d3cde80078ec716a5a9eab

So check your environment. Make sure you've built crypto++ properly
and your linker can find the library. I don't have a Windows machine
handy to test on, but there's no good reason I can think of offhand
you'd need to change any of this code for Windows... none of it is
UNIX-specific. The build steps I took are, but they should be similar
to what you are used to for Windows. The CXXFLAGS are just telling the
compiler where to look for crypto++ headers and the LDFLAGS are
telling it where the library is found and what its name is. You just
need to build crypto++ and link against it the same way you would any
other library.

Good luck,

Geoff

Gary

unread,
Feb 24, 2009, 9:42:37 AM2/24/09
to Crypto++ Users
Hi Dear Geoff !
Yes,you are right,
The problem was due to my Visual Studio environment around "C runtime
library" which is now resolved.
Thank you very much;
Gary

On Feb 24, 8:26 am, Geoff Beier <geoffbe...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages