Java Code Examples for org.web3j.crypto.CipherException#printStackTrace()

The following examples show how to use org.web3j.crypto.CipherException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 6 votes vote down vote up
private void loadFromJson(Uri uri, String pwd) {
    sharedManager.setJsonExcep("");
    try {
        ObjectMapper objectMapper = ObjectMapperFactory.getObjectMapper();
        objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        InputStream is = context.getContentResolver().openInputStream(uri);
        WalletFile walletFile = objectMapper.readValue(is, WalletFile.class);
        credentials = Credentials.create(Wallet.decrypt(pwd, walletFile));
    } catch (JsonParseException jpe) {
        sharedManager.setJsonExcep("JsonParseException");
        jpe.printStackTrace();
    } catch (CipherException ce) {
        if (ce.getMessage().equals("Invalid password provided")) {
            sharedManager.setJsonExcep("WrongPassword");
        } else {
            sharedManager.setJsonExcep("CipherException");
        }
        ce.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 2
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 6 votes vote down vote up
private void loadFromJson(Uri uri, String pwd) {
    sharedManager.setJsonExcep("");
    try {
        ObjectMapper objectMapper = ObjectMapperFactory.getObjectMapper();
        objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        InputStream is = context.getContentResolver().openInputStream(uri);
        WalletFile walletFile = objectMapper.readValue(is, WalletFile.class);
        credentials = Credentials.create(Wallet.decrypt(pwd, walletFile));
    } catch (JsonParseException jpe) {
        sharedManager.setJsonExcep("JsonParseException");
        jpe.printStackTrace();
    } catch (CipherException ce) {
        if (ce.getMessage().equals("Invalid password provided")) {
            sharedManager.setJsonExcep("WrongPassword");
        } else {
            sharedManager.setJsonExcep("CipherException");
        }
        ce.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 3
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 6 votes vote down vote up
private void loadFromJson(Uri uri, String pwd) {
    sharedManager.setJsonExcep("");
    try {
        ObjectMapper objectMapper = ObjectMapperFactory.getObjectMapper();
        objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        InputStream is = context.getContentResolver().openInputStream(uri);
        WalletFile walletFile = objectMapper.readValue(is, WalletFile.class);
        credentials = Credentials.create(Wallet.decrypt(pwd, walletFile));
    } catch (JsonParseException jpe) {
        sharedManager.setJsonExcep("JsonParseException");
        jpe.printStackTrace();
    } catch (CipherException ce) {
        if (ce.getMessage().equals("Invalid password provided")){
            sharedManager.setJsonExcep("WrongPassword");
        } else {
            sharedManager.setJsonExcep("CipherException");
        }
        ce.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 4
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private WalletFile generateWallet(@NonNull ECKeyPair keyPair, String password) {
    WalletFile wallet = null;
    try {
        wallet = Wallet.createLight(password, keyPair);
        walletFriendlyAddress = context.getString(R.string.hex_marker) + wallet.getAddress();
        walletAddress = wallet.getAddress();
    } catch (CipherException e) {
        e.printStackTrace();
    }

    return wallet;
}
 
Example 5
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private WalletFile generateWallet(@NonNull ECKeyPair keyPair, String password) {
    WalletFile wallet = null;
    try {
        wallet = Wallet.createLight(password, keyPair);
        walletFriendlyAddress = context.getString(R.string.hex_marker) + wallet.getAddress();
        walletAddress = wallet.getAddress();
    } catch (CipherException e) {
        e.printStackTrace();
    }

    return wallet;
}
 
Example 6
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private WalletFile generateWallet(@NonNull ECKeyPair keyPair, String password) {
    WalletFile wallet = null;
    try {
        wallet = Wallet.createLight(password, keyPair);
        walletFriendlyAddress = context.getString(R.string.hex_marker) + wallet.getAddress();
        walletAddress = wallet.getAddress();
    } catch (CipherException e) {
        e.printStackTrace();
    }

    return wallet;
}
 
Example 7
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private WalletFile generateWallet(@NonNull ECKeyPair keyPair, String password) {
    WalletFile wallet = null;
    try {
        wallet = Wallet.createLight(password, keyPair);
        walletFriendlyAddress = context.getString(R.string.hex_marker) + wallet.getAddress();
        walletAddress = wallet.getAddress();
    } catch (CipherException e) {
        e.printStackTrace();
    }

    return wallet;
}
 
Example 8
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private WalletFile generateWallet(@NonNull ECKeyPair keyPair, String password) {
    WalletFile wallet = null;
    try {
        wallet = Wallet.createLight(password, keyPair);
        walletFriendlyAddress = context.getString(R.string.hex_marker) + wallet.getAddress();
        walletAddress = wallet.getAddress();
    } catch (CipherException e) {
        e.printStackTrace();
    }

    return wallet;
}
 
Example 9
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
private WalletFile generateWallet(@NonNull ECKeyPair keyPair, String password) {
    WalletFile wallet = null;
    try {
        wallet = Wallet.createLight(password, keyPair);
        walletFriendlyAddress = context.getString(R.string.hex_marker) + wallet.getAddress();
        walletAddress = wallet.getAddress();
    } catch (CipherException e) {
        e.printStackTrace();
    }

    return wallet;
}