This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
blog:spring2016:cjann:journal [2016/04/27 19:41] – [April 25th 2016] cjann | blog:spring2016:cjann:journal [2016/05/02 17:44] (current) – [May 2nd 2016] cjann | ||
---|---|---|---|
Line 683: | Line 683: | ||
====April 27th 2016==== | ====April 27th 2016==== | ||
+ | |||
+ | Hunger induced stupor has left me unable to write code very well (forgot my lunch and too busy to hit the cafeteria). So instead of writing code I will document my current progress on my ssl encryption playground. Fun! | ||
+ | |||
+ | Open ssl seems a smidge more convenient than the mcrypt method. It uses the previously documented objects as parameters. I was getting a very frustrating error for some of it. It was "Error on line 37: open_sslencrypt() expects parameter 4 to be long, string given in ' | ||
+ | |||
+ | It turns out, I was missing a parameter. I thought one of them was optional, the " | ||
+ | |||
+ | My initial idea of encrypting text, dumping it into a file, and then encrypting the file may be too ambitious this late in the game. It could have been a potential project had I intercepted this idea earlier, but as it stands the code requires quite a bit of moving parts. I'm afraid that I wouldn' | ||
+ | |||
+ | I have figured out how to write data into an existing file. The code for creating the file and printing text to the new file doesn' | ||
+ | |||
+ | The current method used for writing to an existing file is actually pretty easy at the basic level, I've been using file_put_contents. It takes only two parameters: the data to be written and the file object. | ||
+ | |||
+ | ====May 2nd 2016==== | ||
+ | |||
+ | Well, half of my dream has been realized. I've successfully used openssl encryption to encrypt a string and output it to an existing file. Using all the same output functions previously covered: open_sslencrypt and file_put_contents. As it stands, the new string overtires the old. If one were so inclined there is probably a constant or different method that appends new text after the text that was previously there. | ||
+ | |||
+ | Yep, after looking at the documentation there is a parameter constant that can be used to append data to the file instead of overwriting it (the documentation calls it a " | ||
+ | |||
+ | Interestingly, | ||
+ | |||
+ | I did throw down some quick php code in windows to test fopen outside of our unix environment. I wasn't able to use php to create a file because of write permissions. So I whipped up some fast code to create a file with fopen and dump some plain text into it. There must be something more to writing and interpreting php code in windows. When I use the file address in the address bar of a browser all I see is a text version of the file. No output file is created. | ||
+ | |||
+ | I did attempt to use the command here http:// | ||
+ | To execute the code from the command line. I got the error message " | ||
+ | |||
+ | Well obviously there' | ||
+ | |||
+ | I'll have to attempt to install required PHP tools when I get home. | ||
+ | |||
+ | Also, I may have potentially found a solution to my file permissions issue. There is a PHP function that changes the chmod values of a file! So, potentially, |