Changeset View
Changeset View
Standalone View
Standalone View
src/org/kde/kdeconnect/Helpers/SecurityHelpers/RsaHelper.java
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 47 | public static void initialiseRsaKeys(Context context) { | |||
---|---|---|---|---|---|
71 | } | 71 | } | ||
72 | 72 | | |||
73 | } | 73 | } | ||
74 | 74 | | |||
75 | public static PublicKey getPublicKey(Context context) throws Exception { | 75 | public static PublicKey getPublicKey(Context context) throws Exception { | ||
76 | try { | 76 | try { | ||
77 | SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); | 77 | SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); | ||
78 | byte[] publicKeyBytes = Base64.decode(settings.getString("publicKey", ""), 0); | 78 | byte[] publicKeyBytes = Base64.decode(settings.getString("publicKey", ""), 0); | ||
79 | | ||||
80 | return KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(publicKeyBytes)); | 79 | return KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(publicKeyBytes)); | ||
80 | | ||||
81 | } catch (Exception e) { | 81 | } catch (Exception e) { | ||
82 | throw e; | 82 | throw e; | ||
83 | } | 83 | } | ||
84 | } | 84 | } | ||
85 | 85 | | |||
86 | public static PublicKey getPublicKey(Context context, String deviceId) throws Exception { | 86 | public static PublicKey getPublicKey(Context context, String deviceId) throws Exception { | ||
87 | try { | 87 | try { | ||
88 | SharedPreferences settings = context.getSharedPreferences(deviceId, Context.MODE_PRIVATE); | 88 | SharedPreferences settings = context.getSharedPreferences(deviceId, Context.MODE_PRIVATE); | ||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |