//----------------------------------------------------------------------------
//
//  ise_test_17.cpp
//
//  Authors: Joe Jarchow, Geoffrey Griffith, Joseph Kadhim, Shinya Daigaku
//           Andrew Pouzeshi
//
//  Sponsor: Tom Lookabaugh, Assistant Professor of Computer Science
//           University of Colorado
//
//  Senior Project: Team ISE (Image Selective Encryption)
//----------------------------------------------------------------------------


// This file is designed to test the ISE production code with test17.sh

#include <stdlib.h>     
#include <iostream>
#include <fstream> 
#include <string>
#include "rijndael-api-fst.h"
#include "ise.h"

using namespace std;

int main(int argc, char * argv[])
{
    /* Encrypt_File Function with Output ISE FIle Name Not Set */
    size_t length = 0;
    int err = 0;
    char * MyKey;
    char * MyJpeg;	

    if (argc > 0)
    {
        length = strlen(argv[1]);
        MyKey = new char [length + 1];
        strcpy (MyKey,argv[1]);
    }
    else
    {
        length = strlen("Bad_Key");
        MyKey = new char [length + 1];
        strcpy (MyKey,"Bad_Key");
    }

    if (argc > 1)
    {
        length = strlen(argv[2]);
        MyJpeg = new char [length + 1];
        strcpy (MyJpeg,argv[2]);
    }
    else
    {
        length = strlen("images/ralphie.jpg");
        MyJpeg = new char [length + 1];
        strcpy (MyJpeg,"images/ralphie.jpg");
    }


    /* Call the constructor with key and jpeg file */
    jpeg_ise encrypt_test(MyKey, MyJpeg);


    /* Encryption */
    err = encrypt_test.encrypt_file();
    if (err != 0) 
    {
      cout << "Encryption failed on file: " << MyJpeg << "with error " << err << endl;
    }
	
    delete [] MyKey;
    delete [] MyJpeg;

    return 0;
}
