Cifrar y descifrar no proporciona el mismo texto simple utilizando AES / ECB / NoPadding

String plain1= "Test";
byte[] cipher = SplashSecure.getInstance().encrypt2(plain1);
String plain2 = SplashSecure.getInstance().decrypt2(cipher);

plain = Test

Despues de descifrarplainText2 debe ser igual aplaintext.Pero no lo es.

Cifrar / Descifrar métodos.

 public void initKey(String key) {
    String paddedKey = Utils.padString(key);
    mKeyspec = new SecretKeySpec(Utils.getBytes(paddedKey), "AES/ECB/NoPadding");
                   // Utils.getBytes returns "paddedKey.getBytes("CP1252")"
 }

public byte[] encrypt2(String data) {
    try {
        Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding");
        cipher.init(Cipher.ENCRYPT_MODE, mKeyspec);
        String paddedData = Utils.padString(data);
        return cipher.doFinal(Utils.getBytes(paddedData));

    } catch(InvalidKeyException e) {
        e.printStackTrace();
    // Series of catch blocks
    }
    return null;
}

public String decrypt2(byte[] cypherText) {
    try {
        Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding");
        cipher.init(Cipher.DECRYPT_MODE, mKeyspec);
        byte[] plainTextBytes = cipher.doFinal(cypherText);
        return Utils.getString(plainTextBytes);
        // Utils.getString returns "new String(bytes, "CP1252");"
    } catch(InvalidKeyException e) {
        // Series of catch blocks.
    } 
    return null;
}

Editar:

public static String padString(String source) {
    char paddingChar = '\0';
    int size = 16;
    int padLength = size - source.length() % size;

    for (int i = 0; i < padLength; i++) {
        source += paddingChar;
    }

    return source;
}

Editar:

Estoy tratando de hacer que el cifrado-descifrado funcione en Windows (otro cliente que encripta, y el servidor) y Android. El cliente de Windows es una aplicación VC ++ que utiliza una clase Rijndael (http://svn.openfoundry.org/pcman/2007.06.03/Lite/Rijndael.h) y usos de Androidhttp://www.cs.ucdavis.edu/~rogaway/ocb/ocb-java/Rijndael.java El cliente de Windows ha cifrado los datos y los ha almacenado en el servidor. Necesito crear un cliente para Android que recupere los datos cifrados, descifre y muestre al usuario.

Estoy seguro de que estoy usando la clave correcta para descifrar.

Respuestas a la pregunta(1)

Su respuesta a la pregunta