xervoio / file-encryptor Goto Github PK
View Code? Open in Web Editor NEWEncrypts files using Node's built-in Cipher class.
Encrypts files using Node's built-in Cipher class.
I think a handy feature would be to keep a flag which determines the deletion of the encrypted file after successful decryption
Hi! first of all, thanks!
I'm using Node 86. I'm not quite sure at which version this started happening, but not fs.unlink is obligated to have a callback. This is causing an error:
fs.js:165 Uncaught NodeError: Callback must be a function
at ReadStream.<anonymous> (/.../file-encryptor.js:70:10)
which makes your decrypting package fail. I can look into this if you like.
Thanks again!
Hi!
I am getting this error when I try to decrypt a file. I am using your example. Any help will be appreciated.
Thanks!
crypto.js:292
var ret = this._binding.final();
^
TypeError: error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length
at Decipher.Cipher.final (crypto.js:292:27)
at ReadStream. (/home/j/lab/node_modules/file-encryptor/lib/file-encryptor.js:57:33)
at ReadStream.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)
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.
There is some way to use File-encryptor in ionic ?
I get warning as follows:
(node:77708) [DEP0106] DeprecationWarning: crypto.createCipher is deprecated.
(Use node --trace-deprecation ...
to show where the warning was created)
Hello All.
I am trying to encrypt almost 10000+ file in a row using following function.
It gives error something like:
## Uncaught Error: EMFILE: too many open files, open 'bun.ogg'
function copyRecursiveSync(src, dest) {
var exists = fs.existsSync(src);
var stats = exists && fs.statSync(src);
var unSelectedArray = getUnSelectedOptionArray();
var isDirectory = exists && stats.isDirectory();
if (exists && isDirectory) {
var destExist = fs.existsSync(dest);
if (!destExist)
fs.mkdirSync(dest);
fs.readdirSync(src).forEach(function (childItemName) {
copyRecursiveSync(path.join(src, childItemName),
path.join(dest, childItemName));
});
} else {
var splitArray = src.split(".");
if (isFileEncrypt(splitArray[1], unSelectedArray) === true) {
encryptor.encryptFile(src, dest, secrateKey, options, function (err) {});
} else {
fs.linkSync(src, dest);
}
}
}
Any Other solution for doing this is also excepted.
Encryption works and decryption also gets completed but gets corrupted file with some less size as compare to original On windows 10 it works.
var encryptor = require('file-encryptor')
var key = '123';
var options = { algorithm: 'aes256' };
encryptor.encryptFile('project/assets/MIHQM16FMSQ811TS2111.mp4', 'project/assets/MIHQM16FMSQ811TS2111Encrypted.dat', key, function(err) {
});
encryptor.decryptFile('project/assets/MIHQM16FMSQ811TS2111Encrypted.dat', 'project/assets/MIHQM16FMSQ811TS2111Decrypted.mp4', key, function(err) {
console.log('Decryption complete');
});
Hi,
do you have a encryptFile which waits for the file to be processed?
it would be very helpful..
I'm wondering how to decrypt an output file by external means.
I encrypted my file with aes256
and the password foo
. I then tried to use openssl enc -aes256 -d -in encrypted.dat -out output_file.txt -k foo
.
It just gives me the error bad magic number
. What am I doing wrong?
Decrypting with file-encryptor.decryptFile
works fine.
I manually commented out line 70 i.e. fs.unlink(outputPath);
in lib/file-encryptor.js and the application doesn't crash after that. I think it is not able to unlink (delete) the file due to some reason.
NOTE: This only happens when invalid key is passed to the decryptFile() function.
Check the attached screenshot (from my heroku console)
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.