Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Procedure to decrypt an AssetFileDescripter #20

Open
jsonfellin opened this issue Sep 4, 2017 · 0 comments
Open

Procedure to decrypt an AssetFileDescripter #20

jsonfellin opened this issue Sep 4, 2017 · 0 comments

Comments

@jsonfellin
Copy link

I'm trying to decrypt an encrypted file in the assets directory. I'm loading it with AssetManager.openFd() and using this method to get the String:

private String readBytes(AssetFileDescriptor file){
        int size = (int) file.getLength();
        byte[] bytes = new byte[size];
        try {
            BufferedInputStream buf = new BufferedInputStream(file.createInputStream());
            buf.read(bytes, 0, bytes.length);
            buf.close();
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return new String(bytes);
    }

This returned string is used in the rnCryptorNative.decrypt(String, password) method. It always returns an empty String. I'm able to decrypt these same files in an Xcode project using RNCryptor just fine. Any suggestions to get this working?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant