Commit 9e9a8383 by DESKTOP-KCR0QC9\28422

4.25_myself

parent 89da278b
//
// Created by MyPC on 2021/4/17.
//
#include "aesencode.h"
#include <stdlib.h>
#include <openssl/aes.h>
#include <openssl/base64.h>
#include <time.h>
#include "string.h"
#include "android/log.h"
#include "mybase64.h"
#define LOG_TAG "WD_COLLECT"
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE,LOG_TAG,__VA_ARGS__);
void generateAESKeyIv(char *key, char*iv, char* key_Table);
void encrpyt_buf(char*m_key,char*m_iv, char *raw_buf, char **encrpy_buf, int len );
void decrpyt_buf(char*m_key,char*m_iv, char *raw_buf, char **encrpy_buf, int len );
int startAESEncode(char*m_key,char*m_iv, char* src,int src_Size,char**encode_ptr,int* out_size);
char *padding_buf(char *buf,int size, int *final_size);
char *padding_buf(char *buf,int size, int *final_size) {
char *ret = NULL;
//填充区的大小
int pidding_size = AES_BLOCK_SIZE - (size % AES_BLOCK_SIZE);
int i;
*final_size = size + pidding_size;
ret = (char *)calloc(1,size+pidding_size);
memcpy( ret, buf, size);
if (pidding_size!=0) {
for (i =size;i < (size+pidding_size); i++ ) {
ret[i] = 0;
}
}
return ret;
}
int startAESEncode(char*m_key,char*m_iv, char* src,int src_Size,char**encode_ptr,int* out_size){
if(src== NULL||src_Size<=0){
return 0;
}
char *after_padding_buf = NULL;
int padding_size = 0;
char *encrypt_buf = NULL;
//进行填充
after_padding_buf = padding_buf(src,src_Size,&padding_size);
if(after_padding_buf==NULL){
return 0;
}
// 进行加密
encrypt_buf = (char *)calloc(1,padding_size);
encrpyt_buf(m_key,m_iv,after_padding_buf,&encrypt_buf, padding_size);
free(after_padding_buf);
//传出加密后的内容
*encode_ptr = encrypt_buf;
*out_size=padding_size;
//-----------------测试代码
//打印源字符串的16进制
unsigned char* temp=( unsigned char*)calloc(1,padding_size*2+1);
int strLen=padding_size;
for(int i=0;i<strLen;++i){
char temp2[0x10]={0};
sprintf(temp2,"%02x",encrypt_buf[i]);
strcat((char *)(temp), (char *)(temp2));
}
LOGV("测试代码->AES加密后的二进制字符串:%s",temp);
free(temp);
// 重新解密
char *decrypt_buf = NULL;
decrypt_buf = (char *)calloc(1,padding_size);
decrpyt_buf(m_key,m_iv, encrypt_buf,&decrypt_buf,padding_size);
LOGV("测试代码->AES重新解密后:%s",decrypt_buf);
free(decrypt_buf);
//----------------------------
return 1;
}
void generateAESKeyIv(char *key,char*iv,char* key_Table){
for(int i=0;i<16;i++){
key[i]=key_Table[rand()%16];
}
for(int i=0;i<16;i++){
iv[i]=key_Table[rand()%16];
}
}
void encrpyt_buf(char*m_key,char*m_iv, char *raw_buf, char **encrpy_buf, int len ) {
AES_KEY aes;
unsigned char key[17] = {0};
unsigned char iv[] = {0};
memcpy(key,m_key,0x10);
memcpy(iv,m_iv,0x10);
// LOGV("m_key= %s",key);
// LOGV("m_iv= %s",m_iv);
AES_set_encrypt_key((const uint8_t *)(m_key), 128, &aes);
AES_cbc_encrypt((const uint8_t *)(raw_buf),
( uint8_t *)(*encrpy_buf),
len, &aes, ( uint8_t *)(iv), AES_ENCRYPT);
// free(key);
}
void decrpyt_buf(char*m_key,char*m_iv, char *raw_buf, char **encrpy_buf, int len ) {
AES_KEY aes;
unsigned char key[17] = {0};
// unsigned char iv[] = "1234567890123457";
unsigned char iv[]={0};
memcpy(key,m_key,0x10);
memcpy(iv,m_iv,0x10);
// LOGV("m_key= %s",key);
// LOGV("m_iv= %s",m_iv);
AES_set_decrypt_key(( uint8_t *)(m_key), 128, &aes);
AES_cbc_encrypt(( uint8_t *)(raw_buf),
( uint8_t *)(*encrpy_buf), len, &aes,
( uint8_t *)(iv), AES_DECRYPT);
}
void aes_Encoder_Base64(char *src,int src_Len,char**encode_ptr,char*out_key,char*out_iv ){
//用于密钥生成的表
char key_Table[]="0123456789abcdef";
//用于接收AES加密后的内容
char *aes_Encode_Content= 0;
//用于接收AES加密后的内容的长度
int aes_Encode_Count=0;
srand(time(0));
//开始随机生成KEY和IV
generateAESKeyIv(out_key,out_iv,key_Table);
//开始进行AES加密
startAESEncode(out_key,out_iv,src,src_Len,&aes_Encode_Content,&aes_Encode_Count);
if(aes_Encode_Content!= 0&&aes_Encode_Count>0){
//------------BASE64 加密
//计算加密后的长度
int num=(aes_Encode_Count/3)*4;
num=num+aes_Encode_Count % 3 ;
//开始加密
char *encode= (char*)(calloc(1,num+1));
Base64Encode(aes_Encode_Content,aes_Encode_Count,encode);
free(aes_Encode_Content);
LOGV("测试代码->对AES获取的密文进行Base64加密: %s ",encode);
//传出结果
*encode_ptr=encode;
//测试代码:BASE64 解密
char *decode= (char*)(calloc(1,num));
Base64Decode(encode,strlen(encode),decode);
unsigned char* temp=(unsigned char*)calloc(1,aes_Encode_Count*2+1);
int strLen=aes_Encode_Count;
for(int i=0;i<strLen;++i){
char temp2[0x10]={0};
sprintf(temp2,"%02x",decode[i]);
strcat((char*)(temp), (char *)(temp2));
}
LOGV("测试代码->重新解密Base64->AES加密后的二进制字符串:%s",temp);
free(temp);
free(decode);
//
}else{
LOGV("AES加密失败");
}
}
\ No newline at end of file
//
// Created by MyPC on 2021/4/17.
//
#ifndef MYTESTACC_AESENCODE_H
#define MYTESTACC_AESENCODE_H
void aes_Encoder_Base64(char *src,int src_Len,char**encode_ptr,char*out_key,char*out_iv );
#endif //MYTESTACC_AESENCODE_H
//
// Created by MyPC on 2021/4/17.
//
#ifndef MYTESTACC_MYBASE64_H
#define MYTESTACC_MYBASE64_H
int Base64Decode(const char *encoded, int encoded_length, char *decoded);
int Base64Encode(const char *src, int src_length, char *encoded);
#endif //MYTESTACC_MYBASE64_H
//
// Created by MyPC on 2021/4/17.
//
#ifndef MYTESTACC_RSAENCODE_H
#define MYTESTACC_RSAENCODE_H
#include "string.h"
void testWriteRSA2PEM();
void rsa_Encoder_Base64(char *src,int src_len,char**out);
#endif //MYTESTACC_RSAENCODE_H
//
// Created by MyPC on 2021/4/17.
//
#include <openssl/base64.h>
int Base64Encode(const char *src, int src_length, char *encoded){
return EVP_EncodeBlock((unsigned char*)encoded, (const unsigned char*)src, src_length);
}
int Base64Decode(const char *encoded, int encoded_length, char *decoded) {
return EVP_DecodeBlock((unsigned char*)decoded, (const unsigned char*)encoded, encoded_length);
}
\ No newline at end of file
//
// Created by MyPC on 2021/4/17.
//
#include <openssl/pem.h>
#include "rsaencode.h"
#include "include/openssl/nid.h"
#include "include/openssl/rsa.h"
#include "include/openssl/bn.h"
#include "include/openssl/bio.h"
#define LOG_TAG "WD_COLLECT"
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE,LOG_TAG,__VA_ARGS__)
#include <android/log.h>
#include <mybase64.h>
char* myDecode( char *content, int size);
char* m_RSAPublicKey=(char*)"oq4FoqCv_kUJMz8qk4-dkrhvM-uNE-Fr5q4Foq4FvHCJ_4S8x4UvKkC6OMhuA5Pzk0mw6kmw_4K9hhnjOR_eOh6vZ5WsWrKmLhuXMauE_k1wq-nFK0hEUlTCMrSlZk-GcyWycHnMTk1MZHsVx-CCWRQ1huSwT57fhRnVxyrMAkPrM0EPAkFhc5FPLyUDAH1nc4SaOy7l6rUjTMkVW5nf6Qj0qeuW606yq-Fhxrhqo068GCJvc-rk6CWlkC_8xCTmh4gST98m_MkCAuunL-PEoCSoLh_0K5UWKHr8_M4Goq4FoqCrMHKdkuW8Er8hKHPJKD8o_hHFoq4FoK";
char* m_RSAPrivateKey="-----BEGIN RSA PRIVATE KEY-----\n"
"MIICXAIBAAKBgQDGPeXspW0p/3jfxg91F4fbXPVQWnJeE/ImIC8hxDaBx5gnh8LO\n"
"S2cGgKXBax0tTUmyvpTLuafVWaNaNFMZJWksixDm9cilKpKoYK8zWrCRvKO3Vode\n"
"fuYaXeifTIHxRylJVEf3wPkQaQE4EsEkwKEvFjot9MROec2GoSx/2Sok7wIDAQAB\n"
"AoGAVUDZWGPsBluvh8yNaTWtX1EizmOXO44oXO0KV+Mh7b4AWT+xLzaOH+XDYuLF\n"
"sW3De/Mp2lMFMmNSNMC729yS1anaawPhHu1NVjnXoNo/33TkUQ2ugAAeyO9p8ubx\n"
"ddSC4O7pKTY7y8MLm4tKFKdCsCvFGPq6K7E7KIuUNHhBKQECQQD+5evEmX/wKGBX\n"
"LsFcm6d7OfHQbbQh1ZUI+rz7YZLNNOlvsui22G0vYBkqaMRhtiudjl49geVth15x\n"
"UE8i9Py/AkEAxxlHgZZOAfz17sfHNj7T1NEez7bclnsvGCehyC9wqUDXe9o8K5Sq\n"
"gI51Y64MpesEyxkzxxJklZ86gpUyH+Jz0QJBAMIkZNqs/2Dvn9FHb0cV1w5oJ+HU\n"
"bKqIfqcEMwRUYPejIVlOLyl01lSLIR/IBCtYEQhD80ttsE0oGaq8vEmnxwkCQFxL\n"
"1r83G1CGoMehqzL1ayPUEbF+9sF3t3w+Gxx/CX4cxgfvQkd9spDH+ZlM/SYJTf6M\n"
"31jgqOpHl0sjuMnZI5ECQGNKd1Ozd7S65gPKjM9GP5nyXWHPcvIQQGBrUVRjuaeH\n"
"9/Edlnwh82mIYSjFYUt0PAyl2fo89OLWFWcvvI4cB1A=\n"
"-----END RSA PRIVATE KEY-----";
//这个函数 可以删除 只用于测试 生成公钥和私钥
void testWriteRSA2PEM()
{
//生成密钥对
RSA *r = RSA_new();
int bits = 1024;
BIGNUM *e = BN_new();
BN_set_word(e, 65537);
RSA_generate_key_ex(r, bits, e, NULL);
BIO *out;
out = BIO_new_file("/data/data/com.reyun.sdktestdemo/privateKey.pem","wb+");
//这里生成的私钥没有加密,可选加密
int ret = PEM_write_bio_RSAPrivateKey(out, r, NULL, NULL, 0, NULL, NULL);
printf("writepri:%d\n",ret);
BIO_flush(out);
BIO_free(out);
out = BIO_new_file("/data/data/com.reyun.sdktestdemo/publicKey.pem","wb+");
ret = PEM_write_bio_RSAPublicKey(out, r);
printf("writepub:%d\n",ret);
BIO_flush(out);
BIO_free(out);
BN_free(e);
RSA_free(r);
}
RSA * initPublicKey(char* publicKeyPath){
RSA *pubkey = RSA_new();
BIO *pubio;
//获取公钥
char* publicKey= myDecode(m_RSAPublicKey,strlen(m_RSAPublicKey));
LOGV("测试代码->公钥解密后:%s",publicKey);
pubio = BIO_new_mem_buf(publicKey,strlen(m_RSAPublicKey));
free(publicKey);
// pubio = BIO_new_file(publicKeyPath, "rb");
if(pubio==NULL){
RSA_free(pubkey);
return NULL;
}
pubkey = PEM_read_bio_RSAPublicKey(pubio, &pubkey, NULL, NULL);
BIO_free(pubio);
return pubkey;
}
RSA * initPrivateKey(char* privateKeyPath){
RSA *prikey = RSA_new();
BIO *priio;
//获取私钥
priio = BIO_new_mem_buf(m_RSAPrivateKey, strlen(m_RSAPrivateKey));
// priio = BIO_new_file(privateKeyPath, "rb");
if(priio==NULL){
RSA_free(prikey);
return NULL;
}
prikey = PEM_read_bio_RSAPrivateKey(priio, &prikey, NULL, NULL);
BIO_free(priio);
return prikey;
}
int RSADecoder(RSA *pubkey,RSA *prikey,char* src,int src_Size,char*des,int* des_Size){
if(pubkey== NULL||src== NULL||src_Size>128||des_Size== NULL){
return 0;
}
//初始化变量
unsigned char plain[128]= {0};
unsigned char cipper[128]={0};
size_t outl=128;
memcpy(plain,src,src_Size);
//打印源字符串的16进制
// unsigned char temp[500]={0};
LOGV("测试代码->RSA加密前:%s\n", plain);
//进行加密
outl=RSA_public_encrypt(strlen((char*)plain),plain,cipper,pubkey,RSA_PKCS1_PADDING);
//打印密文字符串的16进制
if(*des_Size<=outl*2||outl<128){
return 0;
}
memcpy(des,cipper,outl);
*des_Size=outl;
//----------------------------------------
//进行解密的测试代码
char temp[500]={0};
for(int i=0;i<outl;++i){
char temp2[0x10]={0};
sprintf(temp2,"%02x",cipper[i]);
strcat((char *)(temp), (char *)(temp2));
}
LOGV("测试代码->加密后的二进制字符串: %s",temp);
size_t outl2=0;
unsigned char newplain[128]={0};
outl2=RSA_private_decrypt(outl,cipper,newplain,prikey,RSA_PKCS1_PADDING);
LOGV("测试代码->RSA加密后,重新私钥解密:%s", newplain);
RSA_free(prikey);
//------------------------------------------
RSA_free(pubkey);
return 1;
}
void rsa_Encoder_Base64(char *src,int src_len,char**out){
if(src==NULL||src_len<=0||src_len>=128){
return;
}
//读取文件获取公钥
RSA *pubkey =initPublicKey("");
if(pubkey==NULL){
return;
}
RSA *prikey =initPrivateKey("");
if(prikey==NULL){
return;
}
//进行加密
char result[500]={0};
int outSize=sizeof(result);
int flag= RSADecoder(pubkey,prikey,src,src_len,result,&outSize);
if(flag>0){
//------------BASE64 加密
//计算加密后的长度
int num=(outSize/3)*4;
num=num + outSize % 3 ;
//开始加密
char *encode= (char*)(calloc(1,num+1));
Base64Encode(result,outSize,encode);
LOGV("测试代码->对RSA获取的密文进行Base64加密: %s ",encode);
//传出结果
*out=encode;
//-----------------测试代码
char *decode= (char*)(calloc(1,num+1));
Base64Decode(encode,strlen(encode),decode);
char temp[500]={0};
for(int i=0;i<outSize;++i){
char temp2[0x10]={0};
sprintf(temp2,"%02x",decode[i]);
strcat((char *)(temp), (char *)(temp2));
}
LOGV("测试代码->Base64解密->加密后的二进制字符串1: %s",temp);
free(decode);
}else{
LOGV("加密失败");
}
}
char* myDecode( char *content, int size){
unsigned char table[]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x41,0x41,0x41,0x41,0x42,0x33,0x4E,0x7A,0x61,0x43,0x31,0x79,0x63,0x32,0x45,0x41,0x41,0x41,0x41,0x44,0x41,0x51,0x41,0x42,0x41,0x41,0x41,0x42,0x41,0x51,0x44,0x48,0x53,0x47,0x49,0x70,0x41,0x32,0x78,0x66,0x54,0x4C,0x4A,0x4C,0x63,0x62,0x6B,0x74,0x43,0x33,0x47,0x70,0x78,0x37,0x73,0x6D,0x69,0x34,0x71,0x76,0x7A,0x75,0x6F,0x32,0x39,0x50,0x78,0x42,0x44,0x45,0x71,0x69,0x37,0x47,0x71,0x65,0x6B,0x37,0x63,0x6D,0x33,0x67};
char* encode_str=content;
char* bytes1=content;
int num11=size%4;
int num12=0;
if(num11>0){
num12=1;
}
int str_Size=(size/4+num12)*3+1;
char*resultbyte=(char*)calloc(1,str_Size);
memset(resultbyte,0,str_Size);
int i=0;
for ( i=0;i<size/4;++i){
unsigned char byte_1=(unsigned char)bytes1[0+i*4];
unsigned char byte_2=(unsigned char)bytes1[1+i*4];
unsigned char byte_3=(unsigned char)bytes1[2+i*4];
unsigned char byte_4=(unsigned char)bytes1[3+i*4];
int num= byte_1<<2;
int num2=table[num];
int R0=0;
int R1=num2<<2;
int R2=0xDC&R1;
int R3=0X20;
int R4=0x20&(~R1);
R4=R4|R2;
R2=table[byte_2<<2]/16;
int R6=((0X3&R2)|0X20)^R4;
resultbyte[0+i*3]=(char)R6;
R1=table[byte_2<<2]*16;
R3=(R1)&0xE0;
R6=(0X19&(~R1))|R3;
R3=table[byte_3<<2]/4;
R0=0X6&R3;
R3=~R3;
R2=(((0X10|R3)&0X19)|R0)^R6;
resultbyte[1+i*3]=(char)R2;
R1=table[byte_3<<2]<<6;
R2=table[byte_4<<2];
R2=R2^R1;
R0=R0&R1;
R0=R0|R2;
resultbyte[2+i*3]=(char)R0;
}
if(num12>0){
int byte_1=-2;
int byte_2=-2;
int byte_3=-2;
switch (num11){
case 3:{
byte_3=bytes1[size-1];
byte_2=bytes1[size-2];
byte_1=bytes1[size-3];
break;
}
case 2:{
byte_2=bytes1[size-1];
byte_1=bytes1[size-2];
break;
}
default:{
return 0;
}
}
int num= byte_1<<2;
int num2=table[num];
int R0=0;
int R1=num2<<2;
int R2=0xDC&R1;
int R3=0X20;
int R4=0x20&(~R1);
R4=R4|R2;
R2=table[byte_2<<2]/16;
int R6=((0X3&R2)|0X20)^R4;
resultbyte[0+(i)*3]=(char)R6;
if(byte_3>-2){
R1=table[byte_2<<2]*16;
R3=(R1)&0xE0;
R6=(0X19&(~R1))|R3;
R3=table[byte_3<<2]/4;
R0=0X6&R3;
R3=~R3;
R2=(((0X10|R3)&0X19)|R0)^R6;
resultbyte[1+(i)*3]=(char)R2;
}
}
return resultbyte;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment