Hey,
I'm trying to implement a password encryption algorithm used in Funambol mobile sync server in PHP but I'm having hard time as I come from a non-Java background. The code itself seems simple:
encryptionKey = "Omnia Gallia in tres partes divida est";
byte[] newValue = new byte[24];
System.arraycopy(encryptionKey, 0, newValue, 0, 24);
encryptionKey = newValue;
KeySpec keySpec = new DESedeKeySpec(encryptionKey);
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESEde");
Cipher cipher = Cipher.getInstance("DESEde");
SecretKey key = keyFactory.generateSecret(keySpec);
cipher.init(Cipher.ENCRYPT_MODE, key);
cipherBytes = cipher.doFinal(plainBytes);
I'm not necessarily looking for a complete solution, rather pointers on what I can use on PHP's side. Can mcrypt handle this and to what extent? What else do I need? Is this even doable in PHP?
To the curious: I'm building an interface to the Funambol server and I'd like to be able to add users from the interface itself using PHP.