-
Notifications
You must be signed in to change notification settings - Fork 0
/
myCrypto.h
33 lines (30 loc) · 1.19 KB
/
myCrypto.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*----------------------------------------------------------------------------
PA-03: Big Integers & Elgamal Digital Signatures using openSSL.
Written By:
1- Dr. Mohamed Aboutabl
Submitted on: 11//17
----------------------------------------------------------------------------*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
#include <string.h>
/* OpenSSL headers */
#include <openssl/ssl.h>
#include <openssl/evp.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/bio.h>
#include <openssl/rsa.h>
#include <openssl/rand.h>
void handleErrors( char *msg) ;
int BN_write_fd(const BIGNUM *bn, int fd_out);
BIGNUM * BN_read_fd(int fd_in);
BIGNUM * BN_myRandom(const BIGNUM *p);
int encrypt( unsigned char *plaintext, int plaintext_len, unsigned char *key,
unsigned char *iv, unsigned char *ciphertext );
int decrypt( unsigned char *ciphertext, int ciphertext_len, unsigned char *key,
unsigned char *iv, unsigned char *plaintext);
int encryptFile( int fd_in, int fd_out, unsigned char *key, unsigned char *iv );
int decryptFile( int fd_in, int fd_out, unsigned char *key, unsigned char *iv );