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

Can not decrypt #9

Open
Liberateur opened this issue Dec 1, 2017 · 2 comments
Open

Can not decrypt #9

Liberateur opened this issue Dec 1, 2017 · 2 comments

Comments

@Liberateur
Copy link

Liberateur commented Dec 1, 2017

Same problem here : #6

Hey hi, I have a problem to decrypt my archive. The archive works normally.

CODE :

// Get modules
const fs    = require('fs');
const crypt = require('file-encryptor');

// Set key
const key = '256_CHARACTERS_UTF8';

// Encrypt archive
crypt.encryptFile('my_archive_3MB.tar.gz', 'my_archive_3MB.tar.gz.crypt', key, { algorithm: 'aes256' }, (err)=>
{
	// Decrypt archive
	crypt.decryptFile('my_archive_3MB.tar.gz.crypt', 'my_archive_3MB.tar.gz', key, { algorithm: 'aes256' }, (err)=>
	{
		console.log(err);
	});
});

EXECUTE FILE IN CONSOLE :

Error: error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length
    at Decipher.final (crypto.js:158:26)
    at ReadStream.<anonymous> (/Users/cedric/Developer/research/kordacloud/backuper/node_modules/file-encryptor/lib/file-encryptor.js:63:35)
    at emitNone (events.js:91:20)
    at ReadStream.emit (events.js:188:7)
    at endReadableNT (_stream_readable.js:975:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
(node:7968) DeprecationWarning: Calling an asynchronous function without callback is deprecated.
@scottie
Copy link

scottie commented Jun 21, 2018

Issue is cause your key is invalid, due to padding.
Here is fix:
#13

scottie added a commit to scottie/file-encryptor that referenced this issue Jun 21, 2018
Fix for "Can not decrypt" issue XervoIO#9 , padding issue on decrypt fix is in line 62.
scottie added a commit to scottie/file-encryptor that referenced this issue Jun 21, 2018
Fix for "Can not decrypt" issue XervoIO#9 , padding issue on decrypt fix is in line 62.
@AndrWeisR
Copy link

AndrWeisR commented Dec 5, 2018

Issue is cause your key is invalid, due to padding.
Here is fix:
#13

For me, I don't get the "wrong final block length" error in any case.
But when I add this autopadding fix, it causes the file to not be decrypted in its entirety for me. The last few characters of the file are missing.

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

3 participants