File tree Expand file tree Collapse file tree 6 files changed +32
-13
lines changed Expand file tree Collapse file tree 6 files changed +32
-13
lines changed Original file line number Diff line number Diff line change 11
11
}
12
12
13
13
string Crypto::getJniJsonStringyfyData (string key) {
14
- std::string base64Secret = " U2FsdGVkX18IH3Ety1jYeC427casDIBviIHEX4a/Wj9n+mC35JmTMbWv8gT8dAtrdSBM8zQWUBnqFWegV1JwQs311+PrBdKydxlIFoTY8OOGVvDKlKkxTuFzMvCOs9OHlrnvlhY9+Z6XbA4P9gLGOfalgZon3XQRwi7B5LlmtZA =" ;
15
- std::string password = " asdf@1234 " ;
14
+ std::string base64Secret = " U2FsdGVkX1/UMOtZDFe4MXICpo6PG1owJ05gsZlsm9+nw24Oiop5GfL4wxtjRIcQGioS4vu2ciGryMhLed9bi8zluac10wWaEMkf8PbcIZ8Erbtu3prN6H3AwpgyBTLN/Bawg8TxjhiOCFPb6PswGR5BjPYD8YF1O2tcgYECofE =" ;
15
+ std::string password = " QWLqiT85EaY2 " ;
16
16
bool binary = false ;
17
17
std::string plaintext = decryptor::dec (base64Secret, password,binary);
18
18
Original file line number Diff line number Diff line change 1
- #define PRIVATE_KEY @{ @" privateKey" :@" 311+PrBdKydxlIFoTY8OOGVvDKlKkxTuFzMvCOs9OHlrnvlhY9+Z6XbA4P9gLGOfalgZon3XQRwi7B5LlmtZA =" };
1
+ #define PRIVATE_KEY @{ @" privateKey" :@" zluac10wWaEMkf8PbcIZ8Erbtu3prN6H3AwpgyBTLN/Bawg8TxjhiOCFPb6PswGR5BjPYD8YF1O2tcgYECofE =" };
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env node
2
2
const CryptoJS = require ( 'crypto-js' ) ;
3
3
4
- const pass = 'asdf@1234' ;
4
+ const generatePassword = ( ) => {
5
+ var length = 12 ,
6
+ charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' ,
7
+ retVal = '' ;
8
+ for ( var i = 0 , n = charset . length ; i < length ; ++ i ) {
9
+ retVal += charset . charAt ( Math . floor ( Math . random ( ) * n ) ) ;
10
+ }
11
+ return retVal ;
12
+ } ;
13
+
5
14
const encrypt = ( message , password , _iv ) => {
6
15
const encrypted = CryptoJS . AES . encrypt ( message , password , {
7
16
iv : _iv ,
@@ -29,8 +38,9 @@ const makeAndroidJnuFiles = () => {
29
38
const allKeys = getKeys ( KEYS_FILE_NAME ) ;
30
39
const secureKeys = allKeys . secure ;
31
40
const stringifyKeys = JSON . stringify ( secureKeys ) ;
32
- const privateKey = encrypt ( stringifyKeys , pass ) ;
33
- const cppFileContent = makeCppFileTemplateAndroid ( privateKey ) ;
41
+ const password = generatePassword ( ) ;
42
+ const privateKey = encrypt ( stringifyKeys , password ) ;
43
+ const cppFileContent = makeCppFileTemplateAndroid ( privateKey , password ) ;
34
44
const isDoneCrypoCppFile = makeFileInCppAndroidDirectory (
35
45
cppFileContent ,
36
46
'crypto.cpp'
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env node
2
2
const CryptoJS = require ( 'crypto-js' ) ;
3
3
4
- const pass = 'asdf@1234' ;
4
+ const generatePassword = ( ) => {
5
+ var length = 12 ,
6
+ charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' ,
7
+ retVal = '' ;
8
+ for ( var i = 0 , n = charset . length ; i < length ; ++ i ) {
9
+ retVal += charset . charAt ( Math . floor ( Math . random ( ) * n ) ) ;
10
+ }
11
+ return retVal ;
12
+ } ;
5
13
const encrypt = ( message , password , _iv ) => {
6
14
const encrypted = CryptoJS . AES . encrypt ( message , password , {
7
15
iv : _iv ,
@@ -33,8 +41,9 @@ const makeIosJnuFiles = () => {
33
41
const secureKeys = allKeys . secure ;
34
42
const publicKeys = allKeys . public ;
35
43
const stringifyKeys = JSON . stringify ( secureKeys ) ;
36
- const privateKey = encrypt ( stringifyKeys , pass ) ;
37
- const cppFileContent = makeCppFileTemplateIOS ( privateKey ) ;
44
+ const password = generatePassword ( ) ;
45
+ const privateKey = encrypt ( stringifyKeys , password ) ;
46
+ const cppFileContent = makeCppFileTemplateIOS ( privateKey , password ) ;
38
47
const isDoneCrypoCppFile = makeFileInIosDir ( cppFileContent , 'crypto.cpp' ) ;
39
48
40
49
const hFileContent = makeHppFileTemplateIOS ( ) ;
Original file line number Diff line number Diff line change 1
- module . exports . makeCppFileTemplateAndroid = ( data ) => {
1
+ module . exports . makeCppFileTemplateAndroid = ( data , password ) => {
2
2
return `
3
3
#include "crypto.h"
4
4
#include <string>
@@ -12,7 +12,7 @@ module.exports.makeCppFileTemplateAndroid = (data) => {
12
12
13
13
string Crypto::getJniJsonStringyfyData(string key) {
14
14
std::string base64Secret = "${ data } ";
15
- std::string password = "asdf@1234 ";
15
+ std::string password = "${ password } ";
16
16
bool binary = false;
17
17
std::string plaintext = decryptor::dec(base64Secret, password,binary);
18
18
Original file line number Diff line number Diff line change 1
- module . exports . makeCppFileTemplateIOS = ( data ) => {
1
+ module . exports . makeCppFileTemplateIOS = ( data , password ) => {
2
2
return `
3
3
#include "crypto.h"
4
4
#include <string>
@@ -13,7 +13,7 @@ module.exports.makeCppFileTemplateIOS = (data) => {
13
13
14
14
string Crypto::getJniJsonStringyfyData(string key) {
15
15
std::string base64Secret = "${ data } ";
16
- std::string password = "asdf@1234 ";
16
+ std::string password = "${ password } ";
17
17
bool binary = false;
18
18
std::string plaintext = decryptor::dec(base64Secret, password,binary);
19
19
You can’t perform that action at this time.
0 commit comments