Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : Java : Education - Tutorials
Java security, Part 1: Crypto basics
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPrevious
Next Section
3. Ensuring the integrity of a message
  


Message authentication sample execution page 7 of 7


 
D:\IBM>java MessageAuthenticationCodeExample "This is a test!"

Start generating key
Finish generating key

SunJCE Provider (implements DES, Triple DES, Blowfish, PBE, Diffie-Hellman,
HMAC-MD5, HMAC-SHA1)

MAC:
Dkdj47x4#.@kd#n8a-x>

Note that the key generation takes a long time because the code is generating excellent quality pseudo-random numbers using the timing of thread behavior. Once the first number is generated, the others take much less time.

Also, notice that unlike the message digest, the message-authentication code uses a cryptographic provider. (For more on providers, see Security is enriched with third-party libraries.)


Next Section
Main menuSection menuFeedbackPrevious
About IBM | Privacy | Legal | Contact