Posts

Android Open Source

  Open Source Java App RSA Crypto In order to be able to decrypt the encoded text, we need to save and use the private key. The private key can be converted to a string variable and saved to a file. The file can then be read into a string variable. But it will not be possible to recover the private key. No option to convert any data to RSA key format   As they say, this is done for safety. So that you do not store the private key in files in an insecure area. This statement can be disputed, but for practical application this dispute does not make sense. To save and reuse the private key in your application, you need to use STORAGE. Android REPOSITORY. It's the same as Windows. It uses the utility  MCC Android KeyStore API Generate a key and save it in the KeyStore           final KeyGenerator keyGenerator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore"); final KeyGenParameterSpec keyGenParameterSpec = new KeyGenParameterSpec.Builder(&qu

Android Open Source

Image
  Android Java Project RSA Crypto In the previous post, we created a project in which the text from a variable is encrypted using a 1024 bit RSA algorithm. Save the encrypted text to a file oflameron.txt Let's check if the application will work correctly if we just read the ciphertext from the file Let's comment out the module for encrypting and writing text to a file oflameron.txt Run the application from Android Studio on the same smartphone   It can be seen that there is no error in the decoding algorithm, but instead of the original text - "garbage information" Why and what to do - in the next post   Android Java Project  

Android Open Source

  Open Source RSA Crypto Android RSA Crypto Here we have added to the project writing ciphertext to a file oflameron.txt and reading from a ciphertext file. Layout file - in the previous post MainActivity.java  package org.o7planning.bincharbin; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import android.os.Build; import android.os.Bundle; import android.util.Base64; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.security.Key; import java.security.KeyPair; import java.security.KeyPairGenerator; import javax.crypto.Cipher; public class MainActivity extends AppCompatActivity {     //================

Android Open Source

  Open Source Java App RSA Crypto We have redesigned the project to demonstrate RSA encryption . Layout file remains the same activity_main.xml   <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context=".MainActivity">     <TableLayout         android:layout_width="match_parent"         android:layout_height="match_parent"         android:stretchColumns="*"         app:layout_constraintBottom_toBottomOf="parent"         android:id="@+id/tableLayout1">         <TableRow             android:id="@+id/tableRow1"             android:layou

Android Open Source

  Open Source Java App RSA Crypto The project with PCA encryption works fine. Key generation is performed and the given text is encrypted and decoded. But in practice, the ciphertext must be stored, read and decoded. Let's make this version of the project. Then, when our project is running, we will add it to the CryptoNOTE  project. At the same time, the previous encryption option - the symmetric AEC algorithm is also useful to us. First, let's save the ciphertext to a file and read the text from the file. Then we will try to decode it. Source CryptoNOTE project (No RSA)    CryptoNOTE_AES.ZIP  https://drive.google.com/file/d/1QhW9SRS6-fWGyV6hAAifxlUFe8PngCn9/view?usp=sharing  P.S. An interesting option for applying PCA encryption - in combination with databases (for example, goods, users, documents) Open Source Java App  

Android Open Source

RSA crypto example Because the RSA algorithm has a higher resistance against decoding, then using it in your personal notepad for a smartphone has advantages. Let's take a ready-made Open Source Java project CryptoNOTE and replace AES encryption with RSA encryption. Source Code - CryptoNOTE_AES.ZIP  https://drive.google.com/file/d/1QhW9SRS6-fWGyV6hAAifxlUFe8PngCn9/view?usp=sharing   Full Java Project   RSA crypto example

Android Open Source

  RSA Java Crypto Project MainActivity.java Full working example. The markup is given in the previous post. package org.o7planning.rsa; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.util.Base64; import android.util.Log; import android.view.View; import android.widget.TextView; import java.security.Key; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.Provider; import java.security.Security; import java.util.Iterator; import java.util.TreeSet; import javax.crypto.Cipher; public class MainActivity extends AppCompatActivity {     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);         // Original text         String testText = "Open Source Java Project";         TextView originalTextView = (TextView) findViewById(R.id.TXTV);         originalTextView.setText("[ORIGINAL]:\n" +