t2 en cours

This commit is contained in:
OMGiTzPomPom 2022-10-14 12:05:34 +02:00
parent bd5367f3be
commit 141fd0f1ef
6 changed files with 119 additions and 72 deletions

View File

@ -1,18 +1,23 @@
<?php
$form = $_POST;
require('./config.php');
if(isset($_POST['Nom'])) {
if( isset($_POST["Pays"]) && $_POST["Pays"] != '' &&
isset($_POST["Département"]) && $_POST["Département"] != '' &&
isset($_POST["Ville"]) && $_POST["Ville"] != '' &&
isset($_POST["Organisation"]) && $_POST["Organisation"] != '' &&
isset($_POST["Unite"]) && $_POST["Unite"] != '' &&
isset($_POST["Nom"]) && $_POST["Nom"] != '' &&
isset($_POST["Prenom"]) && $_POST["Prenom"] != '' &&
isset($_POST["Email"]) && $_POST["Email"] != '' ) {
$dn = array(
"countryName" => "FR",
"stateOrProvinceName" => "Alpes Maritimes",
"localityName" => "Nice",
"organizationName" => "iut",
"organizationalUnitName" => "iotia",
"commonName" => "Pauline Srifi",
"emailAddress" => "pauline@srifi.fr"
"countryName" => $_POST["Pays"],
"stateOrProvinceName" => $_POST["Département"],
"localityName" => $_POST["Ville"],
"organizationName" => $_POST["Organisation"],
"organizationalUnitName" => $_POST["Unite"],
"commonName" => '$_POST["Nom"]' . ' ' .'$_POST["Prenom"]',
"emailAddress" => $_POST["Email"]
);
$pk = openssl_pkey_new($config);
$req = openssl_csr_new($dn, $pk, $config);
@ -24,6 +29,8 @@ if(isset($_POST['Nom'])) {
echo "Certificat exporté<br />";
echo "Requête exportée<br />";
echo "Clée privée exportée<br />";
} else {
echo '<h1 style="color:#ff0000">Merci de rentez toutes les valeurs demandeés et corectement SVP </h1>';
}
@ -39,6 +46,8 @@ if(isset($_POST['Nom'])) {
<label for="Pays">Pays</label> <input type="text" name="Pays" id="Pays" value=""/><br />
<label for="Organisation">Organisation</label> <input type="text" name="Organisation" id="Organisation" value=""/><br />
<label for="Unite">Unite</label> <input type="text" name="Unite" id="Unite" value=""/><br />
<label for="Email">Email</label> <input type="email" name="Email" id="Email" value=""/><br />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Bj3wcZDX/5CotLNzHZmSvN
HNwIopFAFnctnJxwVcmGVjNCj82oqrEw6yn3ntAQjs95sw7USEo/u6Gl3xTuTnkX
GOcU4H7DCM7l4E4JZJy4wbKJ31X5mSzLycHViyqe86oedfHO5UyHV49g1uXlqrPc
F9IzRKHgWLtTTNlGamUfPfoSCTnHmRHMdSEK1Vx1g3vpcovV6SQn4wyFZFcbclVf
15rmhO2rcCVIjpYGaI6Cd8OmvGyjI9/wVisGv8vVvErmppjVlA17EEVTLjSL2PXe
R5DkCrWvU+kR5g2gkGSq/V2wtFBu6EotzhfWt4UCAwEAAaAAMA0GCSqGSIb3DQEB
BQUAA4IBAQCtTXsHh1L1XWNk6wTQtVJEudusIKuYrDeaFL67WNFzipADXDjBlVbm
neNIbrjc5gnFRhOoL8a78wHs7WwN+hIDf2eisq8UwE3nwHowLAcWrtROct/X1+10
Mrn83Ym5U1gYjLf4Js6etCzGhKhjSGFgplmHk00pDO+3W80xjdlkZIO8ijsxLnQv
IYdq+osSmDJ+mjmrBPNa76+lhFJIcfU+2+4YEFot+K0OQ8sYmMl/W3irKmSb7Ge8
gWYO9ac52uGo6jJixpPvMPPa0utPLhqjrqonZITmtSjc85iBspagk3BV5gnoEX5R
PvBMthvzCkv5SR1jIErExduzlt+NUlMu
-----END CERTIFICATE REQUEST-----

View File

@ -1,3 +1,25 @@
<?php
require('./config.php');
$ret = "";
$deret = "";
if(isset($_POST["Code"]) && $_POST["Code"] != '') {
openssl_public_encrypt($_POST["Code"], $ret, openssl_csr_get_public_key(file_get_contents("./b/requete")));
openssl_private_decrypt($ret,$deret,file_get_contents("./b/clePrivee"));
}
?>
<html>
<form method="POST" action="c.php">
<label for="Code">Texte a chiffrer : </label> <input type="text" name="Code" id="Code" value=""/><br />
<input type="submit" name="Envoyer" value="Envoyer" />
</form>
<p>Texte chiffré : <?php echo $ret?></p>
<p>Texte déchiffré : <?php echo $deret?></p>
</html>

15
TD/TD2/d.php Normal file
View File

@ -0,0 +1,15 @@
<?php
require('./config.php');
?>
<html>
<form method="POST" action="c.php">
<label for="Code">Fichier</label> <input id="File" name="File" value=""/><br />
<input type="submit" name="Envoyer" value="Envoyer" />
</form>
<p>Texte chiffré : <?php echo $ret?></p>
<p>Texte déchiffré : <?php echo $deret?></p>
</html>