wader / aes-arraybuffer Goto Github PK
View Code? Open in Web Editor NEWJavaScript AES and CBC implementation using ArrayBuffer
Home Page: http://wader.github.com/aes-arraybuffer/tests.html
JavaScript AES and CBC implementation using ArrayBuffer
Home Page: http://wader.github.com/aes-arraybuffer/tests.html
For english:
It corrupts files. The file size before encryption does not match after decryption in some situations.
Sample code: stand.tar.gz
Hi,
There is a subtle bug when you encode and pad the last block and that bock falls exactly on a 16 byte boundary). inside crypto.js library.
I've been passing files to various other platforms and things like opensll and they have an issue decoding any file when it exactly a multiple of 16 bytes.
this can be resolved by padding the file with 16 bytes (of 0x10) and then the decryption works on all platforms.
the code change required is
function pkcs_pad_buffer_to_append(length) {
var pad_byte_count = pkcs_max_pad_byte_count - (length % pkcs_max_pad_byte_count);
if (pad_byte_count===0) {
pad_byte_count = 16;
}
var pad_u8 = new Uint8Array(pad_byte_count);
for (var i = 0; i < pad_byte_count; i++) {
pad_u8[i] = pad_byte_count;
}
return pad_u8.buffer;
}
Really appreciate your efforts on this library.
It has been worked very well and save lots of my time until I ran this on iPhone.
I don't think it's an issue from this library(maybe from iOS's problem), but wondering if there might be any work-around.
Issue: tests.html simply fail on iPhone, especially at test_aes_cbc_padding_symmetric()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.