Skip to content

aes::ecb_encryptor result not right and aes::ecb_decryptor error #476

@cam510

Description

@cam510

rust-crypto = "0.2.36"

key = vkWlFRxheBecchrd;
input text = {"datas":{"email":null,"phone":null,"nickName":null,"lastIp":null,"userStatus":null},"status":-1,"msg":"Login Failed"}

main code below:
let mut encrypter = aes::ecb_encryptor(aes::KeySize::KeySize128, key, PkcsPadding);
let json_to_string = {input text below};
let mut result = vec![0; json_to_string.as_bytes().len() * 4];
let mut read_buffer = RefReadBuffer::new(json_to_string.as_bytes());
let mut write_buffer = RefWriteBuffer::new(&mut result);
let encrypt_result = encrypter.encrypt(&mut read_buffer, &mut write_buffer, true);

aes::ecb_encryptor result = lRu5mBFQWBYWT2xNRWUGw5lkxJYQp11/v0d4ngcHp+HASfcfGh37EdjYZyEjST1/LwdkQXhxSeYUD+X/5gM2P2Fk7unIC0cNSU/S7HwlAhBZQDpgz02EZOvN/ejR3gRuMIG92xM8UXzyv6wQeURpBta68Oem4IDWpiixsx8lSw==

right result = lRu5mBFQWBYWT2xNRWUGw5lkxJYQp11/v0d4ngcHp+HASfcfGh37EdjYZyEjST1/LwdkQXhxSeYUD+X/5gM2P2Fk7unIC0cNSU/S7HwlAhBZQDpgz02EZOvN/ejR3gRuMIG92xM8UXzyv6wQeURpBta68Oem4IDWpgAosbMfJUs=

Could you please help to check?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions