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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:09:13+00:00 2026-06-05T17:09:13+00:00

I am trying to read from a file and encrypt the data using AES

  • 0

I am trying to read from a file and encrypt the data using AES in CFB mode with no padding

‘AES/CFB/NoPadding‘. The IV is 16bytes long.

Given that AES by default, works with 16 byte blocks, I would have thought of using a padding scheme if I were using CBC or any other mode but CFB. CFB essentially requires no padding for plaintext.

So the problem is that if my file contains data which is less than 16 bytes, then nothing gets encrypted. If it is greater than 16 bytes, then only the first 16 bytes get encrypted.

This clearly indicates that the block size is kicking in and if there is an underflow or overflow of bytes w.r.t. the block size, then that data/bytes are discarded.

What I don’t understand is while using CFB, I need not pad the data.. right! Then why is the 16byte default block size of AES coming into action and truncating data?

  • 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-05T17:09:19+00:00Added an answer on June 5, 2026 at 5:09 pm

    You have failed to specify the number of bits you want to feedback for that mode, and thus you are getting the default 128 bits. It sounds like you want 8 bits, for which you should use the following argument to getInstance():

    Cipher.getInstance("AES/CFB8/NoPadding");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm trying to read long types from a text file with using readLine() method
I am trying to read from one file and write to another file using:
I am trying to read from a file on the local machine using Ajax.The
I am trying to read data from a file stream as shown below: fileStream.Read(byteArray,
I am trying to read from a file using fgets and sscanf. In my
I am trying to read from a csv file and insert the data into
I'm trying to read from excel file with oleDB provider using C#: using (var
I was trying to read data from some huge file and write them back,
I am trying to read data from a file, tokenize it and sort it,
I'm trying to read from a text file to input data to my java

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.