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

Procedure to decrypt an AssetFileDescripter #20

Open

Description

@jsonfellin

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions