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 8803057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:14:31+00:00 2026-06-14T01:14:31+00:00

I am trying to sign a message which contains in inBuffer byte array using

  • 0

I am trying to sign a message which contains in inBuffer byte array using my own derived key S (also byte array). The snippet of the function from javacard (jc) applet module is given below. I am using javacard2.2.2 library for developing jc applet. I am using android application for sending process request. I am reciving return code ‘6A81‘ which means ‘function not supported’. Now, I have no clue that how to proceed as I failed to understand that it is mentioning about HMAC_SHA256 not supported or I am making some mistake in the function. Please help.

    Signature m_sessionMAC = null;
    HMACKey keyType = null;
    Sign = new byte[64];

    bytesRead = apdu.setIncomingAndReceive();

    // Create HMAC Key Used in Mac
    m_sessionMAC = Signature.getInstance(Signature.ALG_HMAC_SHA_256, false);

    // Create HMAC Key Used in Mac
    keyType = (HMACKey) KeyBuilder.buildKey(KeyBuilder.TYPE_HMAC, KeyBuilder.LENGTH_HMAC_SHA_256_BLOCK_64, false); 
    keyType.setKey(S,(short) 0, (short) S.length);
    m_sessionMAC.init(keyType, Signature.MODE_SIGN);

    //Generate Signature on inBuffer (received data to sign)
    echoOffset = m_sessionMAC.sign(inBuffer, ISO7816.OFFSET_CDATA, ISO7816.OFFSET_LC, Sign , (short)0); 
    Util.arrayCopyNonAtomic(Sign, ( short ) 0, inBuffer, ( short ) 0, echoOffset); 
    apdu.setOutgoingAndSend( ( short ) 0, (short) echoOffset );

Please help me in this regards or also provide any pointers for implementing HMAC_SHA256 or HMAC_SHA1 symmetric crypto. in javacard applet.

Thank you in advance.

  • 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-06-14T01:14:33+00:00Added an answer on June 14, 2026 at 1:14 am

    Most cryptographic algorithms are optional for a JavaCard. Therefore it may be that your card does not support Signature.ALG_HMAC_SHA_256. But HMAC algorithm isn’t very complex therefore you should check if your card supports MessageDigest.ALG_SHA_256.

    If it is supported you can follow RFC2104 and implement HMAC yourself:

    K = HMAC key of length 32
    ipad = the byte 0x36 repeated 32 times
    opad = the byte 0x5C repeated 32 times.
    
    To compute HMAC over the data `text' we perform
    
    H(K XOR opad, H(K XOR ipad, text))
    

    You can test your implementation by comparing your result with the test vectors noted in RFC 4231

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

Sidebar

Related Questions

I'm trying to sign a message using a private key that is encrypted, I
I'm trying to digitally sign a MultiMIME message using the following code. I wonder
I am trying to sign some X509 certificates. My root private key is an
I'm trying to implement a login system to sign into a website using public
I'm developing a Smart card Minidriver and I'm trying to Sign an Email using
I am trying to re-sign the existing android application. But I get a message
I'm using CakePHP 1.3, and trying to make a simple message posting board with
I'm trying to digitally sign a PDF file using THIS project as an example.
When trying to sign a firefox extension with this line: nss-signtool -k TestCert -d
We have a project for an Outlook plugin .vsto that we're trying to sign

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.