From bd5367f3be08946df0c7adc65c554b8e0d192dbc Mon Sep 17 00:00:00 2001 From: OMGiTzPomPom Date: Fri, 7 Oct 2022 12:02:36 +0200 Subject: [PATCH] =?UTF-8?q?d=C3=A9bt=20td2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TD/TD2/a.php | 26 +++++++++++++++++++++++++ TD/TD2/a/certificat | 23 ++++++++++++++++++++++ TD/TD2/a/clePrivee | 28 +++++++++++++++++++++++++++ TD/TD2/a/requete | 17 ++++++++++++++++ TD/TD2/b.php | 47 +++++++++++++++++++++++++++++++++++++++++++++ TD/TD2/b/certificat | 23 ++++++++++++++++++++++ TD/TD2/b/clePrivee | 28 +++++++++++++++++++++++++++ TD/TD2/b/requete | 18 +++++++++++++++++ TD/TD2/c.php | 3 +++ TD/TD2/config.php | 7 +++++++ 10 files changed, 220 insertions(+) create mode 100644 TD/TD2/a.php create mode 100644 TD/TD2/a/certificat create mode 100644 TD/TD2/a/clePrivee create mode 100644 TD/TD2/a/requete create mode 100644 TD/TD2/b.php create mode 100644 TD/TD2/b/certificat create mode 100644 TD/TD2/b/clePrivee create mode 100644 TD/TD2/b/requete create mode 100644 TD/TD2/c.php create mode 100644 TD/TD2/config.php diff --git a/TD/TD2/a.php b/TD/TD2/a.php new file mode 100644 index 0000000..f1dc284 --- /dev/null +++ b/TD/TD2/a.php @@ -0,0 +1,26 @@ + "FR", + "stateOrProvinceName" => "Sophia", + "localityName" => "Valbonne", + "organizationName" => "iut", + "organizationalUnitName" => "iut_iotia", + "commonName" => "b", + "emailAddress" => "iut@univ.fr" + ); + +$pk = openssl_pkey_new($config); +$req = openssl_csr_new($dn, $pk, $config); +$certif = openssl_csr_sign($req, null, $pk, (365*3), $config); +$exportCertif = openssl_x509_export_to_file($certif, "./a/certificat"); +$exportReq = openssl_csr_export_to_file($req, "./a/requete"); +$exportKey = openssl_pkey_export_to_file($pk, "./a/clePrivee", null, $config); + +echo "Certificat exporté
"; +echo "Requête exportée
"; +echo "Clée privée exportée
"; + + diff --git a/TD/TD2/a/certificat b/TD/TD2/a/certificat new file mode 100644 index 0000000..a1196d9 --- /dev/null +++ b/TD/TD2/a/certificat @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIDxDCCAqygAwIBAgIBADANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJGUjEP +MA0GA1UECAwGU29waGlhMREwDwYDVQQHDAhWYWxib25uZTEMMAoGA1UECgwDaXV0 +MRIwEAYDVQQLDAlpdXRfaW90aWExCjAIBgNVBAMMAWIxGjAYBgkqhkiG9w0BCQEW +C2l1dEB1bml2LmZyMB4XDTIyMTAwNzA5NDEyNFoXDTI1MTAwNjA5NDEyNFowezEL +MAkGA1UEBhMCRlIxDzANBgNVBAgMBlNvcGhpYTERMA8GA1UEBwwIVmFsYm9ubmUx +DDAKBgNVBAoMA2l1dDESMBAGA1UECwwJaXV0X2lvdGlhMQowCAYDVQQDDAFiMRow +GAYJKoZIhvcNAQkBFgtpdXRAdW5pdi5mcjCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAKTjKuZWKCxhjtwCVeDu4uYZ98emKbJc9UloO8f7bcWclCyltN6I +9EyhfCcj82/RDg86TKlKvraIf4Z9AFJP0LMtpej7r5iUDGGw+NZgTifbLi0mhNhy +/TaFttF3OnupWgbSlATUmVRQ5QCQoA1ugr1hMO004F3Wgdgh3q0bS+8i6dq5cidF +m0NfiFbncKgFUKRhTIJdkIqugI5E6H1GsGGczmvkRIYYlkn2gIhruMOODbBWMDW9 +L4zq+qpU4aLRa/MqEpZxvFG4PiF7016EfGIgyOPz2JfS3c6Yn3/SaeGUraibqIG1 +tMDsWkVWCzif9qdlsyUumjn2S5YXyaX+S/8CAwEAAaNTMFEwHQYDVR0OBBYEFF0E +cIRUTZsnEoku+SMwkYbQ+oIDMB8GA1UdIwQYMBaAFF0EcIRUTZsnEoku+SMwkYbQ ++oIDMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBACKbV0Op3YIa +VtizjCa781QJNo2zSUFUU3pR/n0vyP4Hq5OEibiXCNnsn1imXf+uFTMZX/b9NVmf +zlQTYBsP6LKtGIDt9XVkG4gtP//cxw3RbDzFtf/1DXYDniA5UmR35waHT9KIPj3J +ejIori0XC6DoJ9e9bQ9B03JAIMUg2TaDDSuSR2fSGHIkRyWewMYFi1CnM6PdFZoJ +DyP2aZuolatY5DS/0yObjrRCfAMo76NxRbnq+ArbMYZpctAlxOU7N9fV0xwTl4xl +dZFWfHHG3Y55J1Fiat5QcrKW5aCqTAHEgsDt0uM1En8Hvx57pjTAM4TZxg/tXOk+ +c13dhwzyW10= +-----END CERTIFICATE----- diff --git a/TD/TD2/a/clePrivee b/TD/TD2/a/clePrivee new file mode 100644 index 0000000..26b70b0 --- /dev/null +++ b/TD/TD2/a/clePrivee @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCk4yrmVigsYY7c +AlXg7uLmGffHpimyXPVJaDvH+23FnJQspbTeiPRMoXwnI/Nv0Q4POkypSr62iH+G +fQBST9CzLaXo+6+YlAxhsPjWYE4n2y4tJoTYcv02hbbRdzp7qVoG0pQE1JlUUOUA +kKANboK9YTDtNOBd1oHYId6tG0vvIunauXInRZtDX4hW53CoBVCkYUyCXZCKroCO +ROh9RrBhnM5r5ESGGJZJ9oCIa7jDjg2wVjA1vS+M6vqqVOGi0WvzKhKWcbxRuD4h +e9NehHxiIMjj89iX0t3OmJ9/0mnhlK2om6iBtbTA7FpFVgs4n/anZbMlLpo59kuW +F8ml/kv/AgMBAAECggEBAIfeVPRWXGYtwZ1TI1blIfz/uug96K/733cst84TRaIH +YyXjKcYRzlTy4C4Udr1V46LypEb/u2UH1yWIDWLGOC/dVpBEDK7Kl+VMAdAMrXo0 +Jrm3utHs9vAdgMbb20oZA4EJtkTAttP+kKVFh01qGb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otp4vhfVsaFw== +-----END PRIVATE KEY----- diff --git a/TD/TD2/a/requete b/TD/TD2/a/requete new file mode 100644 index 0000000..2e99704 --- /dev/null +++ b/TD/TD2/a/requete @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIICwDCCAagCAQAwezELMAkGA1UEBhMCRlIxDzANBgNVBAgMBlNvcGhpYTERMA8G +A1UEBwwIVmFsYm9ubmUxDDAKBgNVBAoMA2l1dDESMBAGA1UECwwJaXV0X2lvdGlh +MQowCAYDVQQDDAFiMRowGAYJKoZIhvcNAQkBFgtpdXRAdW5pdi5mcjCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBAKTjKuZWKCxhjtwCVeDu4uYZ98emKbJc +9UloO8f7bcWclCyltN6I9EyhfCcj82/RDg86TKlKvraIf4Z9AFJP0LMtpej7r5iU +DGGw+NZgTifbLi0mhNhy/TaFttF3OnupWgbSlATUmVRQ5QCQoA1ugr1hMO004F3W +gdgh3q0bS+8i6dq5cidFm0NfiFbncKgFUKRhTIJdkIqugI5E6H1GsGGczmvkRIYY +lkn2gIhruMOODbBWMDW9L4zq+qpU4aLRa/MqEpZxvFG4PiF7016EfGIgyOPz2JfS +3c6Yn3/SaeGUraibqIG1tMDsWkVWCzif9qdlsyUumjn2S5YXyaX+S/8CAwEAAaAA +MA0GCSqGSIb3DQEBBQUAA4IBAQBKcTQ/hjXhp8OgfRg5fmqqwv1/yCuPwN57N20T +0LMbTmHvXNpPPN4aub3TVJWbRRZfTdr3UOr65OScLQliRArTH+tU9kw+A5bQrIbY +TGvtlgfmpqEHSt0IovHwVh+2kxOw+GNNJK2eNv2dn83hHfByhy88Hg7JMWWlmiCj +pAD+oOgLjJhuQgNo8puli5QgRYN2jogdHJn55dOBCQxuvvBHJ0x6MJ2pBxnWtxDd +LYSo3SVW8bsQMOABfnIs1nYtjPBS0QUp2w2zvm94hwseoX+doyq8tHaai7n2oVev +OFvxeU78a/5CTKBOntbRxj5I6ZX9Z9mkoir+zq7TYuDv42gW +-----END CERTIFICATE REQUEST----- diff --git a/TD/TD2/b.php b/TD/TD2/b.php new file mode 100644 index 0000000..bd74ad8 --- /dev/null +++ b/TD/TD2/b.php @@ -0,0 +1,47 @@ + "FR", + "stateOrProvinceName" => "Alpes Maritimes", + "localityName" => "Nice", + "organizationName" => "iut", + "organizationalUnitName" => "iotia", + "commonName" => "Pauline Srifi", + "emailAddress" => "pauline@srifi.fr" + ); + $pk = openssl_pkey_new($config); + $req = openssl_csr_new($dn, $pk, $config); + $certif = openssl_csr_sign($req, null, $pk, (365), $config); + $exportCertif = openssl_x509_export_to_file($certif, "./b/certificat"); + $exportReq = openssl_csr_export_to_file($req, "./b/requete"); + $exportKey = openssl_pkey_export_to_file($pk, "./b/clePrivee", null, $config); + + echo "Certificat exporté
"; + echo "Requête exportée
"; + echo "Clée privée exportée
"; +} + + + +?> + + +
+
+
+
+
+
+
+
+ +
+ + + + diff --git a/TD/TD2/b/certificat b/TD/TD2/b/certificat new file mode 100644 index 0000000..8a534af --- /dev/null +++ b/TD/TD2/b/certificat @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIID6jCCAtKgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBjTELMAkGA1UEBhMCRlIx +GDAWBgNVBAgMD0FscGVzIE1hcml0aW1lczENMAsGA1UEBwwETmljZTEMMAoGA1UE +CgwDaXV0MQ4wDAYDVQQLDAVpb3RpYTEWMBQGA1UEAwwNUGF1bGluZSBTcmlmaTEf +MB0GCSqGSIb3DQEJARYQcGF1bGluZUBzcmlmaS5mcjAeFw0yMjEwMDcwOTQzMjRa +Fw0yMzEwMDcwOTQzMjRaMIGNMQswCQYDVQQGEwJGUjEYMBYGA1UECAwPQWxwZXMg +TWFyaXRpbWVzMQ0wCwYDVQQHDAROaWNlMQwwCgYDVQQKDANpdXQxDjAMBgNVBAsM +BWlvdGlhMRYwFAYDVQQDDA1QYXVsaW5lIFNyaWZpMR8wHQYJKoZIhvcNAQkBFhBw +YXVsaW5lQHNyaWZpLmZyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA +wRVa2pHJ0u6MBrLdjbH1stQ7YUaAGaL++1b7ktrjsrRd+g3iSZamJI1Sa/9dJJOI +irw2EJtUaO83ikHdIIDWUSpNHVn5BzLHasnWXeI58CZ0EfV5PDoCZQjW4QNjFhwz +kxcIO8pQ43UXIbdn3gkROeIU8zb4qBLdrkAPuYDRUOi4+wcNwG4t+YnIrdngCvBu +PAr1WPS/rK9qVoEvcjSkFi4bGnv0OZ2pw05wY195y5Dl6l6H17sF/NVcWsToflsO +CaTTOcyn75VUmXWfPLT1tDvMojAlUdkLEliQo7sHCNzkca51oNKQ+MEdeuMyHQMm +EXHlNTp0ycubKv6QyFahKQIDAQABo1MwUTAdBgNVHQ4EFgQUZXuqW9KrLPaEHTMr +t6mdWXMbswYwHwYDVR0jBBgwFoAUZXuqW9KrLPaEHTMrt6mdWXMbswYwDwYDVR0T +AQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAJpO+QSO2QBgvIurd3rne+F11 +POVaqT84xgR04CjpaYT3p32G5hOKAjamiBfY6Mv+3htT5EANK1ODhbqQSTDn82tj +mVzaSWnaBRYOLRVkssxWrD567xeYCAEKR2sgB0+f+yjtHfHrN8JeGuMhzjtLwUfS +9tl3lxUndwC4uJlTr9Zk9KbSX5CNnhEV31VpS/m799Kwse7s96pMCTY463vAiQZA +GtM/M280KJx+Xe2x2fWj+fH1EaOvjLH8EUkuaaxQxVt+mJatM+qiBUasL2rgrdF0 +XGQU/zNT8we/6i4Y8wpBMoC7bkxrlUgU3IQyLcSe0JflLyXb3WPec1fSQPthxA== +-----END CERTIFICATE----- diff --git a/TD/TD2/b/clePrivee b/TD/TD2/b/clePrivee new file mode 100644 index 0000000..a2f554c --- /dev/null +++ b/TD/TD2/b/clePrivee @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG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SRDvRJuXc1Q +XDsj5utToG8CgYAd+tsvv+Cic45ZtvP5JfzwgHhTKnM7IdYtNK0OcWBUE/eAK/J6 +DbRbwiDj01L0c8Spw12asdoVfiF3XZMFQe4QtDKMX+xZBqjM8CM9OKVe0eXrpVNz +pqkklFAEv4np+L1J2PJtmzmNUwjATMpdEiBm0kBNQhAB7y+RmVBMvE70JQKBgCBn +e8Sbr+9QUBruEVuHxC1Xaj+esrmZ5ZtLTTyv+V9sW80T5z57AAU7zbr7u386JQ/s +7aSt3I5NGgd3jggsQv8+M5QPI6GUbI5M1QkaGKkjZFNEgBTd/BLDTVZxXjwYQ39b +NVhwNInVdPtRQeHYH0ka4OMpjE5wAMC+nMraT9dPAoGARPQBfTozV5eV5AD44z2p +Ryseg4FIWs99yPb7WT1ZcKBtZPgoy1OP/YOfzpHYRq/3oBnl1RfApMb9gAFh71DP +Eqs5T6/pEOokbd4ED1u5CqD9gNcvRA1jg9G6cQK0D4/io6dy1gTLFOQ8AD2/Pzcd +HY8Io1Dw9BwCfQ0lwBcCaAU= +-----END PRIVATE KEY----- diff --git a/TD/TD2/b/requete b/TD/TD2/b/requete new file mode 100644 index 0000000..4f66394 --- /dev/null +++ b/TD/TD2/b/requete @@ -0,0 +1,18 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIC0zCCAbsCAQAwgY0xCzAJBgNVBAYTAkZSMRgwFgYDVQQIDA9BbHBlcyBNYXJp +dGltZXMxDTALBgNVBAcMBE5pY2UxDDAKBgNVBAoMA2l1dDEOMAwGA1UECwwFaW90 +aWExFjAUBgNVBAMMDVBhdWxpbmUgU3JpZmkxHzAdBgkqhkiG9w0BCQEWEHBhdWxp +bmVAc3JpZmkuZnIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDBFVra +kcnS7owGst2NsfWy1DthRoAZov77VvuS2uOytF36DeJJlqYkjVJr/10kk4iKvDYQ +m1Ro7zeKQd0ggNZRKk0dWfkHMsdqydZd4jnwJnQR9Xk8OgJlCNbhA2MWHDOTFwg7 +ylDjdRcht2feCRE54hTzNvioEt2uQA+5gNFQ6Lj7Bw3Abi35icit2eAK8G48CvVY +9L+sr2pWgS9yNKQWLhsae/Q5nanDTnBjX3nLkOXqXofXuwX81VxaxOh+Ww4JpNM5 +zKfvlVSZdZ88tPW0O8yiMCVR2QsSWJCjuwcI3ORxrnWg0pD4wR164zIdAyYRceU1 +OnTJy5sq/pDIVqEpAgMBAAGgADANBgkqhkiG9w0BAQUFAAOCAQEAv3qcUfS5a8Sv +4At7d/nGDj3DAHr9BorRR3WRV6Ybv6c+2X5Ia66AhrnZrPhkgU/8Sf7YoB+ZAJ7s +OQyX/n7id/lqaTslXl6rimRqOIR/PaJKFHAZQQHiNC95P6C11N+7TXum75b20QtX +aC+rlgQOCPFsnkvdKgyexNLK0Jzyn61tE9N2/4I38FZAj1e6zfyLd32Ws+QIagBC +C4KNQwgLtY/1r64WsofiUUNa/SQXwFpaDTCPi359q/m5PAdxMCdj3rrIA8H24I15 ++dtbBUNEbHPgYuwqIMP7GyJvzuTAdexUJU+ITS0ozl44MiOc6oQo4Q8rvv8QCm2U +kxKX5T5EHw== +-----END CERTIFICATE REQUEST----- diff --git a/TD/TD2/c.php b/TD/TD2/c.php new file mode 100644 index 0000000..6d218f5 --- /dev/null +++ b/TD/TD2/c.php @@ -0,0 +1,3 @@ + "C:\\laragon\\bin\\php\\php-8.1.10-Win32-vs16-x64\\extras\\ssl\\openssl.cnf" +); + +?> \ No newline at end of file