Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1103965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:25:04+00:00 2026-05-17T01:25:04+00:00

try { // Generate a key for the HMAC-MD5 keyed-hashing algorithm KeyGenerator keyGen =

  • 0
try { // Generate a key for the HMAC-MD5 keyed-hashing algorithm
     KeyGenerator keyGen = KeyGenerator.getInstance("HmacMD5");
     SecretKey key = keyGen.generateKey(); 
    // Generate a key for the HMAC-SHA1 keyed-hashing algorithm 
keyGen = KeyGenerator.getInstance("HmacSHA1"); 
        key = keyGen.generateKey(); } 
        catch (java.security.NoSuchAlgorithmException e) { }

Above code would give us keys to digest a message using HMAC. Now i wanted to implement a HMAC logic in java where the key would be given by user.
Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:25:05+00:00Added an answer on May 17, 2026 at 1:25 am

    Construct a KeySpec using the provided user key (either a SecretKeySpec if it’s a byte array, or a PBEKeySpec if it’s a password), then use a SecretKeyFactory to turn that into a SecretKey.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to generate a MD5 fingerprint to obtain a map api key using
I try to generate such XML using REXML <root> <add key='foo' value='bar'/> </root> But
I try to generate a csv file through a lot of functions like that
I try to generate title in all levels of the officers but I get
I try to debug a javascript function called from Generate Thumbnails plugin in Wordpress.
In my program I generate classes dynamically but when I try: String[] args =
How to generate a KeyboardInterrupt in Windows? while True: try: print 'running' except KeyboardInterrupt:
I'd like to generate RSA-SHA1 signatures with the RSA-Sign JavaScript Library . Specifically, I'd
I am trying to generate a key for encryption: public static final String ENCYT_ALGORITHM
I try to get Key from KeyStore. I created a keystore by Keytool: keytool

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.