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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:27:51+00:00 2026-06-07T19:27:51+00:00

I have a String (stringToEncrypt) , it is encrypted by AES-128 and got a

  • 0

I have a String (stringToEncrypt) , it is encrypted by AES-128 and got a byte[]. I try to write that byte[] to database as a String. An example below :

String encryptedString = new String(aes.encode(stringToEncrypt.getBytes()));

“encode” method gets a byte[] as parameter and returns a byte[]. “aes” object makes the AES-128 encoding process.
The problem is, when i try to write encryptedString to DB, some characters that are written to DB is not the same as “String encryptedString”. I think the problem is about the charset of DB or on my code. Any suggestions please?

  • 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-07T19:27:52+00:00Added an answer on June 7, 2026 at 7:27 pm

    String is the wrong data type for your problem. If you really need to encode raw bytes to a string, use base64.

    If it is possible, try to store byte[] directly into the database.

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

Sidebar

Related Questions

I have string that look like Array that fetched from other webservice like this
I have string that displays UTF-8 encoded characters, and I want to convert it
i have string stored in python variables, and i am outputting a html that
I have string separated by dot ('.') characters that represents a hierarchy: string source
i have string (uri) that i need to decode in c++ , its have
I have string that I want to chop to array of substrings of given
I have string which contains either A ,B, C, or D (example A123 or
I have string on the format $0Option one$1$Option two$2$Option three (etc) that I want
I have string with many & and | operators . If I try to
I have string like below, $string = test coontevt [gallery include=\12,24\] first [gallery include=\12,24\]

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.