मुझे बेस 64 स्ट्रिंग में एन्कोडेड एक आरएसए प्राइवेटकी पीकेसीएस # 8 एक वेब सेवा (स्वयं द्वारा बनाई गई) से प्राप्त होता है। मेरा एंड्रॉइड ऐप इस कुंजी को सुरक्षित रूप से फोन में कहीं सेव करना होगा।एंड्रॉइड कीस्टोर - आरएसए प्राइवेटकी को कैसे बचाएं
एंड्रॉइड के 4.3 संस्करण से, यह नई कीस्टोर एपीआई का उपयोग कर संभावित बचत कुंजी है। मुझे एक article with code axample मिला है जो दिखाता है कि कुंजी को स्टोर करने के लिए आवश्यक विशिष्टता के साथ कीपैयर कैसे उत्पन्न करें। और चाबियाँ ठीक करने के बाद।
// generate a key pair
Context ctx = getContext();
Calendar notBefore = Calendar.getInstance()
Calendar notAfter = Calendar.getInstance();
notAfter.add(1, Calendar.YEAR);
KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec.Builder(ctx)
.setAlias("key1")
.setSubject(
new X500Principal(String.format("CN=%s, OU=%s", alais,
ctx.getPackageName())))
.setSerialNumber(BigInteger.ONE).setStartDate(notBefore.getTime())
.setEndDate(notAfter.getTime()).build();
KeyPairGenerator kpGenerator = KeyPairGenerator.getInstance("RSA", "AndroidKeyStore");
kpGenerator.initialize(spec);
KeyPair kp = kpGenerator.generateKeyPair();
// in another part of the app, access the keys
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
keyStore.load(null);
KeyStore.PrivateKeyEntry keyEntry = (KeyStore.PrivateKeyEntry)keyStore.getEntry("key1", null);
RSAPublicKey pubKey = (RSAPublicKey)keyEntry.getCertificate().getPublicKey();
RSAPrivateKey privKey = (RSAPrivateKey) keyEntry.getPrivateKey();
लेकिन मुझे समझ में नहीं आता कि मैं इसे मौजूदा कुंजी कैसे सहेज सकता हूं। कोई भी मेरी मदद कर सकता हैं? अग्रिम धन्यवाद
http://nelenkov.blogspot.com/2012/05/storing-application-secrets-in-androids.html –