Hi Jeff,

Thanks alot for your help. Really appreciate it.

Yeah I think the actual code is fine but just think I have compiled
the cryptopp library incorrectly or using the wrong gcc command when
it comes to running it on my computer. Hopefully will get it working
in the lab though.

Could you please quickly explain a few things about the code you gave
me to make sure I understand it?

Does the key need to be entered into the code before a calculation can
be made? How would I go about that if i wanted to hard code it in?
Is the string "hello world" the data to be hashed?
Where abouts should I add that code to print the result?
Is the variable mac the variable that holds the result of the mac
calculation? And therefore it is mac that is compared at the receiver
to verify for authentication?
What do the verifier pieces of code do and how do they work?

Cheers,

Adam.

On Jun 10, 1:45 am, "Jeffrey Walton" <[EMAIL PROTECTED]> wrote:
> Hi Adam,
>
> > Basically am just trying to implement the MAC field in a packet header
> > for authentication. Is the digest the result of the calculation on the
> > data?
>
> What to MAC and how to MAC it depends on your protocol. I presume it
> is TLS or IPSec? Unfortunately, I have not looked at the standard(s)
> lately, so I can't say what you should do.
>
> > I am just trying to find a way of calculating the MAC
>
> You now have the code.
>
> > and then printing it so I can see I have a result
>
> Add the following after including "hex.h":
>
> string encoded;
> StringSource( mac, true,
>     new HexEncoder(  new StringSink( encoded ),
>         true,   // uppercase
>         2       // grouping size
>     )
> );
>
> > I tried implementing the code you gave me in a file called auth.cpp
> > and used this makefile to try and put it all together:
>
> I haven't seen Tux in quite some time, but I believe you need to
> include the library as an arument to gcc. I think it is -lcryptlib.a
>
> Jeff
>
> On Mon, Jun 9, 2008 at 8:24 PM, Adam Harding <[EMAIL PROTECTED]> wrote:
>
> > Hey,
>
> > Basically am just trying to implement the MAC field in a packet header
> > for authentication. Is the digest the result of the calculation on the
> > data? I am just trying to find a way of calculating the MAC and then
> > printing it so I can see I have a result...and then getting the
> > receiver to do the same calculation and see if they match up in order
> > to authenticate the data (ie it has not been changed)...is that the
> > way to go?
>
> > Since my programming is not great am just trying to find some example
> > code that I can use HMAC-SHA for to perform the calculation on some
> > test data, see it works by a printf and then adapt this to implement
> > by code.
>
> > I tried implementing the code you gave me in a file called auth.cpp
> > and used this makefile to try and put it all together:
>
> > CC=g++
>
> > authentication: auth.o   hmac.o  sha.o
>
> >        $(CC)   auth.o  hmac.o  sha.o   -o      authentication
>
> > auth.o: auth.cpp hmac.h sha.h
>
> >        $(CC)   -c      auth.cpp
>
> > sha.o: sha.cpp sha.h
>
> >        $(CC)   -c      sha.cpp
>
> > hmac.o: hmac.cpp hmac.h
>
> >        $(CC)   -c      hmac.cpp
>
> >  but got this error:
>
> > auth.cpp:
> > (.text._ZN8CryptoPP21SimpleKeyingInterfaceC2Ev[CryptoPP::SimpleKeyingInterface::SimpleKeyingInterface()]
> > +0x4): undefined reference to `vtable for
> > CryptoPP::SimpleKeyingInterface'
> > auth.o: In function `CryptoPP::SecBlock<unsigned char,
> > CryptoPP::AllocatorWithCleanup<unsigned char, false>
> >>::SecBlock(unsigned int)':
> > [SNIP]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to