Code example for KeyPair

Methods: getPrivate, getPublic

0
 
        // save the keys in the file system 
		FileOutputStream pubOut = context.openFileOutput(PUBLIC_KEY_FILENAME, Context.MODE_PRIVATE);
		FileOutputStream privOut = context.openFileOutput(PRIVATE_KEY_FILENAME, Context.MODE_PRIVATE);
		 
		pubOut.write(keyPair.getPublic().getEncoded());
		privOut.write(encryptPrivateKey(keyPair.getPrivate()));
		 
		pubOut.flush();
		privOut.flush();
         
		pubOut.close();
        privOut.close();
         
	    return keyPair;
    } 
     
     
    /** 
     * Compute a shared secret for the ENCRYPTION_ALGORITHM. This should always be computed, and may never be stored. 
     *