public static AsymmetricMasterSecret getAsymmetricMasterSecret( @NonNull Context context, @Nullable MasterSecret masterSecret) { try { byte[] djbPublicBytes = retrieve(context, ASYMMETRIC_LOCAL_PUBLIC_DJB); byte[] djbPrivateBytes = retrieve(context, ASYMMETRIC_LOCAL_PRIVATE_DJB); ECPublicKey djbPublicKey = null; ECPrivateKey djbPrivateKey = null; if (djbPublicBytes != null) { djbPublicKey = Curve.decodePoint(djbPublicBytes, 0); } if (masterSecret != null) { MasterCipher masterCipher = new MasterCipher(masterSecret); if (djbPrivateBytes != null) { djbPrivateKey = masterCipher.decryptKey(djbPrivateBytes); } } return new AsymmetricMasterSecret(djbPublicKey, djbPrivateKey); } catch (InvalidKeyException | IOException ike) { throw new AssertionError(ike); } }