• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

8- byte array Intialization Vector

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I'm working on Triple DES encryption with parameters in JAVA 5:

Key Size : 16 bytes
Key : This is an MD5 hash of the shared key (eg: MD5 hash of omCryptoExchange in this case)
CipherMode : CBC (Cipher Block Chaining)
Padding Mode : PKCS7

How do I create an 8- byte array initialization vector with the following values in it, { 240, 3, 45, 29, 0, 76, 173, 59 } in java.

Equivalent C++ code is

// The Initialization Vector for the DES encryption routine
private readonly byte[] IV = new byte[8] { 240, 3, 45, 29, 0, 76, 173, 59 };
 
Sheriff
Posts: 22849
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried the same in Java?
 
Salman Moha
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Prime wrote:Have you tried the same in Java?




I trying to implement this in java.

private readonly byte[] IV = new byte[8] { 240, 3, 45, 29, 0, 76, 173, 59 };



Here's is my JAVA Code but skeptical about it.

private static byte[] IV = new byte[] { (byte)240, (byte)3, (byte)45,(byte)29, (byte)0, (byte)76, (byte)173, (byte)59 };


Method:
IvParameterSpec zeroIv = new IvParameterSpec(IV, 0, 8)


Please direct me.
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd have thought your first example would work just fine, is it not?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic