Secret key of length >16 doesn't work

Open Beginner friendly
#22 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Domain
security

Research direction

Find the ImageSteganography class and locate the convertKeyTo128bit method. Change the substring index from 15 to 16. Verify the fix by running any existing tests related to encryption or key handling, or create a simple test with a secret key longer than 16 characters.

Written by the indexing model from the issue text.

Description

Describe the bug
If the user passes secret key of length >16 to ImageSteganography constructor the convertKeyTo128bit method won't convert it properly.
Instead of:
result = result.substring(0, 16);
it has:
result = result.substring(0, 15);

And the encryption step fails then.

Possible solution without the pull request
It is easy to fix in the library, but if it won't be fixed here is an easy workaround:

  1. Create class ImageSteganographyV2 which extends ImageSteganography
  2. Copy the whole code(since ImageSteganography doesn't open access to fields)
  3. Fix the bug by changing 15 to 16 in "result = result.substring(0, 15);"
  4. Create ImageSteganography instances using new class. For example:

ImageSteganography imageSteganography = new ImageSteganographyV2(message, secretKey, originalImage);

Everything else can stay the same

Dominant language
Java
Stars
160
Forks
66
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aagarwal1012/Image-Steganography-Library-Android

All issues in aagarwal1012/Image-Steganography-Library-Android

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.