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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:08:28+00:00 2026-05-31T01:08:28+00:00

I have written some (functional) AES encryption code using Java’s built in encryption libraries,

  • 0

I have written some (functional) AES encryption code using Java’s built in encryption libraries, as follows, but I’d like to use a 256-bit key. However, I’d like to do this without the user having to install to Unlimited Strength Cryptography Policy files.

Now, I’ve heard that using the BouncyCastle Lightweight API can allow me to do this, but unfortunately I’m having a great deal of trouble getting my head around it, and am struggling to fit any documentation that helps me.

Here is a my current code, in which ‘content’ is the byte array to be encrypted:

KeyGenerator kgen = KeyGenerator.getInstance("AES");
int keySize = 128;
kgen.init(keySize);
SecretKey key = kgen.generateKey();
byte[] aesKey = key.getEncoded();
SecretKeySpec aesKeySpec = new SecretKeySpec(aesKey, "AES");
Cipher aesCipher = Cipher.getInstance("AES");
aesCipher.init(Cipher.ENCRYPT_MODE, aesKeySpec);
byte[] encryptedContent = aesCipher.doFinal(content);

How would I go about re-implementing this with the BouncyCastle Lightweight API? Can anyone help me out and/or point me in the direction of some simple example code?

I’m also interesting in any other solutions that allow 256-bit key AES encryption without the need for the user to install the unlimited strength policy files.

Many thanks!

  • 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-31T01:08:29+00:00Added an answer on May 31, 2026 at 1:08 am

    This question and answer is a useful starting point.

    256bit AES/CBC/PKCS5Padding with Bouncy Castle

    The next best place to look is the test code for the LW APIs and then the JCE Provider code. The JCE Provider code is a wrapper around the LW libraries – so if you want to know how to do it, that’s the best place to see it.

    By the JCE Provider code, I mean the BC implementation.

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

Sidebar

Related Questions

I have written some code to look at properties using reflection. I have retrieved
I have some encryption code that has been written in Perl (also a code
I am using ImageMagick for Perl use Image::Magick; I have written functional code to
I have written some code in my VB.NET application to send an HTML e-mail
I have written some CSS which targets elements using the parent > child selector.
I have written some code for playing a .wav through my application. Now I
I have written some jQuery ajax code where I am sending a request to
I have written some code to ensure that items on an order are all
I have written some physics simulation code in C++ and parsing the input text
I have written some JavaScript and jQuery code that accepts only numeric input in

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.