Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/04/2010, 20:46
abcdefghi
 
Fecha de Ingreso: enero-2010
Mensajes: 191
Antigüedad: 15 años, 2 meses
Puntos: 7
Respuesta: SOAP y la clase org.apache.ws.security

Hola Gente,

He encontrado la formá en que trabaja, tenía un salt por eso no coincidia, al final utilizaba algo como esto:

Código PHP:
public class StringEncrypter {

    
Cipher ecipher;

    public 
StringEncrypter(String passPhrase) {

        
// 8-bytes Salt
        
byte[] salt = {
            (
byte0xA9, (byte0x9B, (byte0xC8, (byte0x32,
            (
byte0x56, (byte0x34, (byte0xE3, (byte0x03
        
};

        
// Iteration count
        
int iterationCount 19;

            
KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), saltiterationCount);
            
SecretKey key SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(keySpec);

            
ecipher Cipher.getInstance(key.getAlgorithm());

            
// Prepare the parameters to the cipthers
            
AlgorithmParameterSpec paramSpec = new PBEParameterSpec(saltiterationCount);

            
ecipher.init(Cipher.ENCRYPT_MODEkeyparamSpec);
    }

    public 
String encrypt(String str) {

            
// Encode the string into bytes using utf-8
            
byte[] utf8 str.getBytes("UTF8");

            
// Encrypt
            
byte[] enc ecipher.doFinal(utf8);

            
// Encode bytes to base64 to get a string
            
return new sun.misc.BASE64Encoder().encode(enc);

     }

 } 
Aunque necesito pasarlo a PHP, entiendo que escapa a sus conocimiento por lo que si a alguno ya lo ha hecho, les agradecería el comentario.

Saludos.