Encrypting and decrypting using a Hex string

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Encrypting and decrypting using a Hex string

abdelrahman almahmoud
Hi

I know that bouncycastle has encryption and decryption functionality but is it possible to use a Hex as the key for enc/dec?

I am aware that this is not the best way to approach this as the key files are stored in plaintext etc but this is for testing purposes

It would be very helpful if anyone shares any simple code to help me start 

Sincerely,

Reply | Threaded
Open this post in threaded view
|

Re: Encrypting and decrypting using a Hex string

Arshad Noor
http://www.wrox.com/WileyCDA/WroxTitle/Beginning-Cryptography-with-Java.productCd-0764596330,descCd-DOWNLOAD.html

On 6/2/2013 1:10 AM, abdelrahman almahmoud wrote:

> Hi
>
> I know that bouncycastle has encryption and decryption functionality but
> is it possible to use a Hex as the key for enc/dec?
>
> I am aware that this is not the best way to approach this as the key
> files are stored in plaintext etc but this is for testing purposes
>
> It would be very helpful if anyone shares any simple code to help me start
>
> Sincerely,
>

Reply | Threaded
Open this post in threaded view
|

Re: Encrypting and decrypting using a Hex string

Daniil Ivanov
Hi,

I'm not sure what you mean by Hex, but a key is always an array of bytes.
Here is an example of encryption with symmetric AES algorithm utilizing Java Cryptography Extension (JCE):
http://stackoverflow.com/questions/13102788/is-there-any-sample-java-code-that-does-aes-encryption-exactly-like-this-website

Reading book suggested by Arshad also might help.

Thanks, Daniil


On Sun, Jun 2, 2013 at 11:25 AM, Arshad Noor <[hidden email]> wrote:
http://www.wrox.com/WileyCDA/WroxTitle/Beginning-Cryptography-with-Java.productCd-0764596330,descCd-DOWNLOAD.html


On 6/2/2013 1:10 AM, abdelrahman almahmoud wrote:
Hi

I know that bouncycastle has encryption and decryption functionality but
is it possible to use a Hex as the key for enc/dec?

I am aware that this is not the best way to approach this as the key
files are stored in plaintext etc but this is for testing purposes

It would be very helpful if anyone shares any simple code to help me start

Sincerely,



Reply | Threaded
Open this post in threaded view
|

Re: Encrypting and decrypting using a Hex string

abdelrahman almahmoud
Thanks
I will try to get that book as it will prove very useful
Until I get it I was trying the example Daniil shared with me which seems to be able to do what I want it to
Just to clarify, if I want to reverse the encryption, I can replace ENCRYPT_MODE with DECRYPT_MODE or will I need further changes?


On Mon, Jun 3, 2013 at 1:04 AM, Daniil Ivanov <[hidden email]> wrote:
Hi,

I'm not sure what you mean by Hex, but a key is always an array of bytes.
Here is an example of encryption with symmetric AES algorithm utilizing Java Cryptography Extension (JCE):
http://stackoverflow.com/questions/13102788/is-there-any-sample-java-code-that-does-aes-encryption-exactly-like-this-website

Reading book suggested by Arshad also might help.

Thanks, Daniil


On Sun, Jun 2, 2013 at 11:25 AM, Arshad Noor <[hidden email]> wrote:
http://www.wrox.com/WileyCDA/WroxTitle/Beginning-Cryptography-with-Java.productCd-0764596330,descCd-DOWNLOAD.html


On 6/2/2013 1:10 AM, abdelrahman almahmoud wrote:
Hi

I know that bouncycastle has encryption and decryption functionality but
is it possible to use a Hex as the key for enc/dec?

I am aware that this is not the best way to approach this as the key
files are stored in plaintext etc but this is for testing purposes

It would be very helpful if anyone shares any simple code to help me start

Sincerely,




Reply | Threaded
Open this post in threaded view
|

Re: Encrypting and decrypting using a Hex string

Daniil Ivanov
Yes, and also replace message with encrypted message.

Thanks, Daniil


On Mon, Jun 3, 2013 at 8:25 AM, abdelrahman almahmoud <[hidden email]> wrote:
Thanks
I will try to get that book as it will prove very useful
Until I get it I was trying the example Daniil shared with me which seems to be able to do what I want it to
Just to clarify, if I want to reverse the encryption, I can replace ENCRYPT_MODE with DECRYPT_MODE or will I need further changes?


On Mon, Jun 3, 2013 at 1:04 AM, Daniil Ivanov <[hidden email]> wrote:
Hi,

I'm not sure what you mean by Hex, but a key is always an array of bytes.
Here is an example of encryption with symmetric AES algorithm utilizing Java Cryptography Extension (JCE):
http://stackoverflow.com/questions/13102788/is-there-any-sample-java-code-that-does-aes-encryption-exactly-like-this-website

Reading book suggested by Arshad also might help.

Thanks, Daniil


On Sun, Jun 2, 2013 at 11:25 AM, Arshad Noor <[hidden email]> wrote:
http://www.wrox.com/WileyCDA/WroxTitle/Beginning-Cryptography-with-Java.productCd-0764596330,descCd-DOWNLOAD.html


On 6/2/2013 1:10 AM, abdelrahman almahmoud wrote:
Hi

I know that bouncycastle has encryption and decryption functionality but
is it possible to use a Hex as the key for enc/dec?

I am aware that this is not the best way to approach this as the key
files are stored in plaintext etc but this is for testing purposes

It would be very helpful if anyone shares any simple code to help me start

Sincerely,