2

Is it possible to encrypt/decrypt a string using AES with a BigInteger (given one, not a randomly generated number) as a key in Java?

1 Answer 1

2

You don't need BigInteger for AES key creation, the key needs to be 16 bytes long for 128-bit encryption, 24 bytes long for 192-bit encryption and 32 bytes long for 256-bit encryption.

So the key would be a byte array rather than a BigInteger. BigInteger is used in RSA and other PKI's because of the huge numbers needed to create the keys but AES doesn't do that.

Hope this helps.

Sign up to request clarification or add additional context in comments.

2 Comments

and BigIntegers can be byte arrays :)
Thanks for this, you gave me a clue to generate a key :) +1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.