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

  • SEARCH
  • Home
  • 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 735637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:30:47+00:00 2026-05-14T07:30:47+00:00

I am trying to take an AES HMAC of a file using the openssl

  • 0

I am trying to take an AES HMAC of a file using the openssl command line program on Linux. I have been looking at the man pages but can’t quite figure out how successfully make a HMAC. I can encrypt a file using the enc command with openssl however I can’t seem to create a HMAC. The encryption looks like the following:

openssl enc -aes-256-cbc -in plaintext -out ciphertext

Any advice or tutorials would be wonderful

  • 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-14T07:30:48+00:00Added an answer on May 14, 2026 at 7:30 am

    You may be asking about CBC-MAC. For that, I think you just encrypt your message or file with an IV of 0 and then take the last block (16 bytes for AES256-cbc). I found a blog post that describes how to do this with OpenSSL:

    openssl enc -e -aes-256-cbc -K 0123456789ABCDEF -iv 0000000000000000 < file | tail -c 16 | od -A n
    
    • -K is where you provide your key, which the wiki page says should be different than what you’re using to encrypt the file, if you’re encrypting it at all.
    • -iv obviously provides an all-zero IV, which is the key for CBC-MAC.
    • The tail -c 16 is to get the last AES256-cbc block, which is 16-bytes long.
    • od is to convert it to hex, which that web site says is common. Otherwise instead of od -A n you could do base64 if that’s more applicable, or leave it off completely to have just the raw bytes.

    You can’t take an AES HMAC of a file because AES256-cbc is a block cipher, not a hashing algorithm. AES256-cbc is for encrypting and decrypting a file. HMAC is for verifying a file’s integrity and requires a hash algorithm at its core such as SHA-1 or MD5.

    Are you trying to sign or verify a file, or encrypt it? To sign, check out the OpenSSL dgst command and use simple HMACs like MD5 or SHA-1, or go all out and digitally sign it with DSS/DSA.

    Also, I believe using a block cipher as a MAC is called an EMAC, but OpenSSL doesn’t do EMAC as far as I know. EMAC just takes the last block of an encrypted file and encrypts it to create a MAC.

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

Sidebar

Related Questions

Trying to take in several file names from the user at the command line
I have a datagridview with 9 columns. I am simply trying take the value
I am trying to take user input directly from console using getline into a
I am trying to take a text file with fractions on it. Convert the
I'm trying to take an existing php file which I've built for a page
I'm trying to take string in input using Scanner. But it asks me more
I have been trying to extend my own answer on drawing Gantt Charts to
I'm trying take the names that I am given by the program after it
I am trying to take an object and have it fade out 5 seconds
I'm trying to take a screenshot of my Android application using Robotium, I'm using

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.