mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-24 04:40:13 +01:00
Introduced new AES-256 encryption method for new emails
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
613f25848d
commit
d2f3f018c0
@ -162,18 +162,29 @@ int retrieve_file_from_archive(char *filename, int mode, char **buffer, FILE *de
|
||||
return 1;
|
||||
}
|
||||
|
||||
// The new encryption scheme uses piler id starting with 5000....
|
||||
|
||||
if(cfg->encrypt_messages == 1){
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
EVP_CIPHER_CTX_init(&ctx);
|
||||
EVP_DecryptInit_ex(&ctx, EVP_bf_cbc(), NULL, cfg->key, cfg->iv);
|
||||
if(strstr(filename, "/5000")){
|
||||
EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, cfg->key, cfg->iv);
|
||||
} else {
|
||||
EVP_DecryptInit_ex(&ctx, EVP_bf_cbc(), NULL, cfg->key, cfg->iv);
|
||||
}
|
||||
|
||||
blocklen = EVP_CIPHER_CTX_block_size(&ctx);
|
||||
#else
|
||||
ctx = EVP_CIPHER_CTX_new();
|
||||
if(!ctx) goto CLEANUP;
|
||||
|
||||
EVP_CIPHER_CTX_init(ctx);
|
||||
EVP_DecryptInit_ex(ctx, EVP_bf_cbc(), NULL, cfg->key, cfg->iv);
|
||||
if(strstr(filename, "/5000")){
|
||||
EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, cfg->key, cfg->iv);
|
||||
} else {
|
||||
EVP_DecryptInit_ex(ctx, EVP_bf_cbc(), NULL, cfg->key, cfg->iv);
|
||||
}
|
||||
|
||||
blocklen = EVP_CIPHER_CTX_block_size(ctx);
|
||||
#endif
|
||||
|
||||
|
@ -265,11 +265,13 @@ void create_id(char *id, unsigned char server_id){
|
||||
|
||||
get_random_bytes(buf, RND_STR_LEN/2, server_id);
|
||||
|
||||
// New encryption scheme using AES-256
|
||||
buf[0] = 0x50;
|
||||
|
||||
for(i=0; i < RND_STR_LEN/2; i++){
|
||||
sprintf(id, "%02x", buf[i]);
|
||||
id += 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,14 +109,14 @@ int store_file(struct session_data *sdata, char *filename, int len, struct confi
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
EVP_CIPHER_CTX_init(&ctx);
|
||||
EVP_EncryptInit_ex(&ctx, EVP_bf_cbc(), NULL, cfg->key, cfg->iv);
|
||||
EVP_EncryptInit_ex(&ctx, EVP_aes_256_cbc()(), NULL, cfg->key, cfg->iv);
|
||||
blocklen = EVP_CIPHER_CTX_block_size(&ctx);
|
||||
#else
|
||||
ctx = EVP_CIPHER_CTX_new();
|
||||
if(!ctx) goto ENDE;
|
||||
|
||||
EVP_CIPHER_CTX_init(ctx);
|
||||
EVP_EncryptInit_ex(ctx, EVP_bf_cbc(), NULL, cfg->key, cfg->iv);
|
||||
EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, cfg->key, cfg->iv);
|
||||
blocklen = EVP_CIPHER_CTX_block_size(ctx);
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user