Giter VIP home page Giter VIP logo

aes-arraybuffer's People

Contributors

wader avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aes-arraybuffer's Issues

Encryption padding breaks Cross platform decryptions

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;
}

iOS compatibility

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()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.