Brought decryptFunc up to date with the rest of the site

This commit is contained in:
OakBaron (queso)
2019-04-21 13:57:07 -04:00
parent 3755484cba
commit e3743176e7
2 changed files with 37 additions and 14 deletions

View File

@@ -1,4 +1,13 @@
<?php
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Encrytion and stuff</title>
<meta name=viewport content=width=device-width,initial-scale=1.0>
<link rel=stylesheet href=style.css type=text/css>
</head>
<body class=center>
<?php
require "enc.php";
$words = file_get_contents($_FILES["encDoc"]["tmp_name"]);
$data = simplexml_load_string($words) or die("Couldn't make object");
@@ -8,7 +17,18 @@
$iv = hex2bin($data->iv);
$tag = hex2bin($data->tag);
$ciphertext = $data->content;
$dec = decrypt($ciphertext, $key, $iv, $tag);
echo "Your decrypted content:<br>";
echo decrypt($ciphertext, $key, $iv, $tag);;
?>
if($dec != ""){
echo "<h2>Your decrypted content:</h2>";
echo "<p id=decCont>".$dec."</p>";
}else{
echo "<h2>Error</h2>";
echo "<p id=decCont>Your content could not be decrypted.<br>Wrong password, maybe?</p>";
}
?>
<br><br>
<p class=center><a href=/cs/encrypt.php>Encrypt another file</a></p>
<p class=center><a href=/cs/decrypt.php>Decrypt another file</a></p>
</body>
</html>

View File

@@ -40,6 +40,9 @@ textarea{
font-size: 0.9em;
color: inherit;
}
#decCont{
font-family: monospace;
}
button{
display: block;
margin-left: auto;