Encrypting with DES and password

I'm using the code I've found here to encrypt using DES. I'm sending this value to 3rd party servce, but doesn't seem to work.

Question in code given code, salt and iteration are used as parameters to create initialize the cipher with the parameter spec:

// Prepare the parameter to the ciphers
AlgorithmParameterSpec paramSpec = new PBEParameterSpec( salt, iterationCount );

// Create the ciphers
ecipher.init(Cipher.ENCRYPT_MODE, key , paramSpec);
dcipher.init(Cipher.DECRYPT_MODE, key , paramSpec);

If I change the iteration count, I have different results.

How can I know what is being used in the other side of the wire? The only thing I know from this third party service, is, the algorithm to use is DES and of course the secret password.

What am I missing?

Answers


"DES" itself is just a single iteration. Its successor, "Triple DES" encrypts each data block three times performs three iterations of the algorithm. If you are expected to perform encryption using just "DES", one iteration should be correct.

In general, it is considered bad practice to write your own cryptographic functions for anything other than toy implementations. Writing secure, correct libraries for cryptography can sometimes be tricky. Consider using the Java Cryptography Architecture, part of the Java Platform SE 6.


Need Your Help

Using Scrum on a “Personal Time” Project

agile scrum

I'm starting up a personal project to develop some open source software. I want to use Scrum as the PM process on this (as I like the Product Backlog, prioritisation, and if I can get them, the

Determine if a user is a Fan of MY page

facebook permissions facebook-like

I'd like to determine whether a user is a fan of MY facebook page, without getting any Facebook-connect permissions from them first.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.