cordova-safe
cordova-safe copied to clipboard
Cordova 6.0.0 Android 5.1.1 IOS 3.8.0/4.0.1 error code 1 on en-/decrypt
I am using OS X and started with the quick start guide for ionic here. What i have done:
- "ionic start myApp sidemenu".
- cordova plugin add cordova-plugin-file
- cordova plugin add cordova-safe
- Changed PlaylistsCtrl to:
`.controller('PlaylistsCtrl', function($scope) {
$scope.playlists = [
{ title: 'Reggae', id: 1 },
{ title: 'Chill', id: 2 },
{ title: 'Dubstep', id: 3 },
{ title: 'Indie', id: 4 },
{ title: 'Rap', id: 5 },
{ title: 'Cowbell', id: 6 }
];
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() { var p = cordova.file.dataDirectory + 'steuern-guide.pdf';
console.log('$ionicView.afterEnter');
var safe = cordova.plugins.disusered.safe,
key = 'someKey';
function success(encryptedFile) {
console.log('Encrypted file: ' + encryptedFile);
}
function error(err) {
console.log('Error with cryptographic operation: ' + err);
}
console.log('Path: ' + p);
safe.decrypt(p, key, success, error);
}
})`
- Tested android 3.8.0. and 4.0.1
Result: Whatever i do, i get Error with cryptographic operation: 1. At first i thought i am working on the wrong path, but a test with resolveLocalFileSystemURL and FIleEntry.moveTo showed that i can rename the corresponding file. So i can access it with r/w rights.
Expected Result: Encrypted version of the file
I have uploaded the current situation here, everything except the builded files.