Birke
March 21, 2018, 3:38pm
1
I try tu use (File Encryption Plugin ), but i get the folowing message in the Console:
Native: tried calling FileEncryption.encrypt, but the FileEncryption plugin is not installed.
Install the FileEncryption plugin: 'ionic cordova plugin add cordova-safe'
I follow the Installtion steps, but is not working.
cordova plugin list says:
com.plugins.shortcut 0.0.2 "Home Shortcuts"
cordova-plugin-device 2.0.1 "Device"
cordova-plugin-facebook4 1.9.1 "Facebook Connect"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-opener2 2.0.19 "File Opener2"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-ionic-keyboard 2.0.5 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-shortcuts-android 0.1.0 "Android Shortcuts"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-safe 2.0.1 "Safe"
Any Solutions?
How you are testing this? What command are you running?
Birke
March 22, 2018, 6:50am
3
I use
ionic cordova run android
and the message comes in the console from chrome dev tools
Is your code wrapped in a platform.ready()
call to make sure the platform is loaded?
Birke
March 22, 2018, 4:00pm
5
Yes, it is
this.platform.ready().then(() => {
let extdirectory;
if (this.platform.is('android')) {
extdirectory = cordova.file.externalRootDirectory;
} else if (this.platform.is('ios')) {
extdirectory = cordova.file.tempDirectory;
}
let transfer = this.transfer.create();
this.file.resolveLocalFilesystemUrl(extdirectory + 'test')
.then((DirectoryEntry) => {
console.log('getStaticFile -> resolveLocalFilesystemUrl: ', DirectoryEntry);
transfer.download(url, DirectoryEntry.nativeURL + filename, true)
.then((FileEntry) => {
console.log('Download: ', FileEntry);
// plugin not installed ????????????????????
// this.fileEncryption.encrypt(FileEntry.nativeURL, '123456')
// .then((encrypt) => {
// console.log('this.fileEncryption.encrypt: ', encrypt);
// })
// .catch((error) => {
// console.log('this.fileEncryption.encrypt Error: ', error);
// })
this.listFiles();
this.addFileToStorage(FileEntry.nativeURL, ObjId);
})
.catch((error) => {
console.log('Transfer download Error: ', error);
});
})
.catch((error) => {
console.log('getStaticFile -> resolveLocalFilesystemUrl Error: ', error);
});
});
Birke
March 29, 2018, 1:31pm
6
I try it again in a new blank starter ionic app
import { Component } from '@angular/core';
import { NavController, Platform } from 'ionic-angular';
import { FileEncryption } from '@ionic-native/file-encryption';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController,
private fileEncryption: FileEncryption,
public platform: Platform) {
this.platform.ready().then(() => {
console.log('Platform ready!!!');
this.fileEncryption.decrypt('assets/json/secret.json', 'secretKey');
this.fileEncryption.encrypt('assets/json/secret.json', 'secretKey');
});
}
}
Same error:
Native: tried calling FileEncryption.decrypt, but the FileEncryption plugin is not installed.
Install the FileEncryption plugin: 'ionic cordova plugin add cordova-safe'
Anybody use this plugin or knowing solution?
Orthogonal to whatever else is going on here, there is no point in encrypting anything that’s burned into the app binary (such as stuff underneath /assets
), as the key used to decrypt it would be universal. The only use for file encryption would be if both the encryption and decryption were done using a user-entered key that is independent of the contents of the app binary.
Birke
April 9, 2018, 2:11pm
8
Of course you are right. However, I did not go beyond the test itself to adjust these parameters accordingly, since the plugin is not installed.
Any solution on this after 2 years? Forum and Google do not seem to have a solution to this.