mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Merge pull request #3378 from yurydelendik/aes-padding
Removes AES padding
This commit is contained in:
commit
510387f551
2 changed files with 29 additions and 12 deletions
|
@ -1066,6 +1066,8 @@ var DecryptStream = (function DecryptStreamClosure() {
|
|||
this.str = str;
|
||||
this.dict = str.dict;
|
||||
this.decrypt = decrypt;
|
||||
this.nextChunk = null;
|
||||
this.initialized = false;
|
||||
|
||||
DecodeStream.call(this);
|
||||
}
|
||||
|
@ -1075,13 +1077,22 @@ var DecryptStream = (function DecryptStreamClosure() {
|
|||
DecryptStream.prototype = Object.create(DecodeStream.prototype);
|
||||
|
||||
DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
|
||||
var chunk = this.str.getBytes(chunkSize);
|
||||
var chunk;
|
||||
if (this.initialized) {
|
||||
chunk = this.nextChunk;
|
||||
} else {
|
||||
chunk = this.str.getBytes(chunkSize);
|
||||
this.initialized = true;
|
||||
}
|
||||
if (!chunk || chunk.length === 0) {
|
||||
this.eof = true;
|
||||
return;
|
||||
}
|
||||
this.nextChunk = this.str.getBytes(chunkSize);
|
||||
var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
|
||||
|
||||
var decrypt = this.decrypt;
|
||||
chunk = decrypt(chunk);
|
||||
chunk = decrypt(chunk, !hasMoreData);
|
||||
|
||||
var bufferLength = this.bufferLength;
|
||||
var i, n = chunk.length;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue