Skip to content

Commit

Permalink
Read and generate uniq private Key
Browse files Browse the repository at this point in the history
  • Loading branch information
vzakharchenko committed Oct 1, 2020
1 parent af2b7ea commit b13286c
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 144 deletions.
38 changes: 31 additions & 7 deletions OUTLANDER_PHEV_REMOTE_APK/smali/com/inventec/iMobile2/a2/g.smali
Original file line number Diff line number Diff line change
Expand Up @@ -4751,20 +4751,44 @@
.end method



.method public static getPrivateKey()[B
.registers 2
.registers 4

.prologue
.line 137
const-string v0, "BqeVGXJf+df/FhoWfFVDBw=="
const/4 v3, 0x0

const/4 v1, 0x0
.line 203
const/16 v1, 0x10

invoke-static {v0, v1}, Landroid/util/Base64;->decode(Ljava/lang/String;I)[B
new-array v0, v1, [B

move-result-object v0
.line 204
.local v0, "bytes":[B
new-instance v1, Ljava/util/Random;

return-object v0
invoke-direct {v1}, Ljava/util/Random;-><init>()V

invoke-virtual {v1, v0}, Ljava/util/Random;->nextBytes([B)V

.line 205
const-string v1, "privateKey.txt"

.line 206
invoke-static {v0, v3}, Landroid/util/Base64;->encodeToString([BI)Ljava/lang/String;

move-result-object v2

.line 205
invoke-static {v1, v2}, Lcom/inventec/iMobile2/a2/g;->readFromFile(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

move-result-object v1

invoke-static {v1, v3}, Landroid/util/Base64;->decode(Ljava/lang/String;I)[B

move-result-object v1

return-object v1
.end method

.method public static saveFile2([B)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
.param p1, "this$0" # Lcom/example/myapplication/MainActivity;

.prologue
.line 225
.line 229
iput-object p1, p0, Lcom/example/myapplication/MainActivity$1;->this$0:Lcom/example/myapplication/MainActivity;

invoke-direct {p0}, Ljava/lang/Object;-><init>()V
Expand All @@ -42,7 +42,7 @@
.param p1, "view" # Landroid/view/View;

.prologue
.line 228
.line 232
const-string v0, "Replace with your own action"

const/4 v1, 0x0
Expand All @@ -55,13 +55,13 @@

const/4 v2, 0x0

.line 229
.line 233
invoke-virtual {v0, v1, v2}, Lcom/google/android/material/snackbar/Snackbar;->setAction(Ljava/lang/CharSequence;Landroid/view/View$OnClickListener;)Lcom/google/android/material/snackbar/Snackbar;

move-result-object v0

invoke-virtual {v0}, Lcom/google/android/material/snackbar/Snackbar;->show()V

.line 230
.line 234
return-void
.end method
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.io.FileReader;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.util.Random;

import javax.crypto.SecretKey;

Expand Down Expand Up @@ -199,7 +200,10 @@ public static void saveFile2(byte[] data) {
}

public static byte[] getPrivateKey() {
return Base64.decode("BqeVGXJf+df/FhoWfFVDBw==", Base64.DEFAULT);
byte[] bytes = new byte[16];
new Random().nextBytes(bytes);
return Base64.decode(readFromFile("privateKey.txt",
Base64.encodeToString(bytes,Base64.DEFAULT)), Base64.DEFAULT);
}


Expand Down
Loading

0 comments on commit b13286c

Please sign in to comment.