Java tutorial
//package com.java2s; import java.security.KeyStore; import java.security.PrivateKey; public class Main { public static PrivateKey androidPrvKey(KeyStore keyStore, String alias) { try { KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(alias, null); return privateKeyEntry.getPrivateKey(); } catch (Exception expt) { expt.printStackTrace(); throw new RuntimeException(expt); } } }