Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cam510 opened this issue Jan 8, 2022 · 1 comment
Open

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

cam510 opened this issue Jan 8, 2022 · 1 comment

Comments

@cam510
Copy link

cam510 commented Jan 8, 2022

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?

@newpavlov
Copy link

This crate is unmaintained. See: https://rustsec.org/advisories/RUSTSEC-2016-0005.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants