Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 460c26e9 authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Use deliberately public API rather than org.apache cruft.

InputStreamHelper is scheduled for deletion. As a bonus, the new code is more
efficient.

Change-Id: Ied8b87fa24f8506cf748b0d4c99ee7e2ae201483
parent 7ab17a34
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@ import android.os.Environment;
import android.os.FileUtils;
import android.os.Process;

import org.apache.harmony.luni.util.InputStreamHelper;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -32,6 +30,8 @@ import java.security.SecureRandom;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;

import libcore.io.IoUtils;

/**
 *@hide
 */
@@ -117,13 +117,10 @@ public class SystemKeyStore {

    public byte[] retrieveKey(String keyName) throws IOException {
        File keyFile = getKeyFile(keyName);

        if (!keyFile.exists()) {
            return null;
        }

        FileInputStream fis = new FileInputStream(keyFile);
        return InputStreamHelper.readFullyAndClose(fis);
        return IoUtils.readFileAsByteArray(keyFile.toString());
    }

    public void deleteKey(String keyName) {