disusered / cordova-safe

File encryption for Cordova.
MIT License
35 stars 22 forks source link

Cordova 6.0.0 Android 5.1.1 IOS 3.8.0/4.0.1 error code 1 on en-/decrypt #11

Open FrankTheDevop opened 8 years ago

FrankTheDevop commented 8 years ago

I am using OS X and started with the quick start guide for ionic here. What i have done:

  1. "ionic start myApp sidemenu".
  2. cordova plugin add cordova-plugin-file
  3. cordova plugin add cordova-safe
  4. 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);
    }

})`

  1. 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.