Adrian Rivoire
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    helo :)! ``` Les premiers exercices sont à réaliser avec OpenSSL. Préférez saisir les commandes en intégralité depuis votre shell : $openssl rsautl -arg1 -arg2 -in param1 plutôt que de rentrer dans la console openssl : $openssl OpenSSL> rsautl -arg1 -arg2 -in param1 vous bénéficierez ainsi des fonctionnalités d'historique et de complétude des commandes shell absentes dans la console OpenSSL. Pour obtenir de l'aide sur une commande, par exemple "rsautl" : $openssl rsautl –help 🚧 Attention 🚧 : L'encodage des données manipulées (entrée et sortie) lors d'une opération cryptographique est important. En entrée d'un algorithme, bien qu'il s'agisse de la même information, une donnée encodée de deux manières différentes (ex : ASCII ou UTF-16) fournira deux résultats différents. De même, la sortie d'un algorithme peut être représentée de plusieurs manières différentes : en binaire, en chaîne de caractère hexadécimal, en base64, etc. Pour cette série de questions, nous vous indiquons le format dans lequel vous devez nous fournir vos réponses. Cependant, gardez à l'esprit qu'à moins que cela ne soit précisé, les données doivent toujours être manipulées au 🚧 format binaire 🚧. ``` # Question 1 1 - Analyse d'un certificat x509 -----BEGIN CERTIFICATE----- MIIFfDCCA2SgAwI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eQIg2fzi6MXahqE6H lwqbKXh4x3J6kmiOXyvTpnHWcV5uY00Py8RZAgMBAAGjGjAYMAkGA1UdEwQCMAAw CwYDVR0PBAQDAgZAMA0GCSqGSIb3DQEBCwUAA4ICAQCl3BvPBhHvHAmUfH6gFqwz i3uXXbvwX/Y7S1OQ0kbI+6WgMtzBnreUQcQfd/00ginU7vbivgz4a9MS6LWnNLsI gLY4oUwu1W7qrUlve6Nsg6f1FGQlbKZfhZ/TLEX5hXgzG95lCP6LMPpynC1tHBvk +6seJc6iQ/m2QfNWp54lN8quhVAaK9XXu2Gw4006t/M26Eqvyt6NrPfGqMmBqkhm 7D4y9c7Fc+AzlHQLa32x3KZfUtO93Hg4eT97k3Muas/76Tni4d64nc7S9syW+wlF Biu948jW1ro1ay58tiXAipjlphNLxOvr3cNusd92htD47PFwcRuKp42RXxO2XVum iy9LMRiJ0OiGqudfgS23Xbrtmy6+o+98oA+pJIyv3AWVGmZV2nDIlJH8k6KBfaAa fkT/kjSEVQ9TagjokvM5NwuycSJAOwUu0HZYfZ+69c34cLOI1laWynoWZcMkTTr4 UIMeYE9lq7AR549i+Pzu/1IiZvldD35mSeD//EX39Pd4H75ejI5xry+fORUxxXdm yBZjlCJaWufrupt4jDIfgAdjMZSpacCyYglga0SbfSBiLTlu9u++Pe0Pr3EgYA5W fJbV7g6TmObYN39LlPhGOgWD8sYCabLt25Cn1e1fx2deOdfpSKN6R4ZahNmnQDDL aKdBjNuCPhQ1y49ZeqV3Hg== -----END CERTIFICATE----- ## 1.1 - Quel est le propriétaire de ce certificat ? Reportez ici la ligne fournissant cette information Le propriétaire est SRS 2021-2022. `Subject: C = FR, L = PARIS, O = EPITA, CN = SRS 2021-2022, emailAddress = srs@epita.fr` ## 1.2 - Indiquez les champs constituant les composants mathématiques de la clé RSA contenus dans le certificat - [x] Serial Number - [x] Subject Public Key Info/Public Key Algorithm - [x] Subject Public Key Info/Modulus - [x] Subject Public Key Info/Exponent - [ ] X509v3 extensions/X509v3 Authority Key Identifier - [ ] X509v3 extensions/X509v3 Subject Key Identifier - [x] Signature Algorithm ## 1.3 - De quelle longueur est cette clé ? 4096 bits # Question 2 1/ Créez un fichier texte nommé texte.txt contenant la phrase : "Groupe XX, ce 02/12/2021, je vous dois encore 5000 euros." en encodage ASCII, en respectant les espaces, avec XX votre numéro de binôme (01 pour le 1er binôme), et un saut de ligne à la fin ("\n") du document. 2/ Avec la commande "dgst", créez le hash du contenu de ce fichier (attention, une donnée d'entrée pour un algorithme de hachage est toujours binaire) avec l'algorithme sha-256 et stockez-le dans un fichier nommé texte.hash. ## 2.1 - Quelle est la commande ? ``` openssl dgst -out texte.hash texte.txt ``` ## 2.2 - Quel hash obtenez-vous ? (fournir la représentation hexadécimal sans espace du hash) ``` e78619c858278f12d526a14467fc1e9ea5938e4ac45af4316c21d97a3051b8df ``` # Question 3 : 3 - Analyse de la clé privée ``` -----BEGIN RSA PRIVATE KEY----- MIIJKAIBAAKCAgEAo9mY1lisRDzacCJC7orhVDeI/+DUdKbWxPnq6e7p73pX6EhP lUipvW4EOXLRzK1HZTarj/J3O113oH5pn3BgYfyCYIHUbeDsWWFMkKcP1FNE7FkX /ZP+Syeh6RzAEBVhFUm2jqmmyQF3BiHEiRY3lwvIjcH8HWDmJaC/B/RSd6HpJnwQ lsJWNR5kNCNqdvaZBI2nBjvAkrZ6yXuZQNGw0eUKGfW4eTWOhG1HaIe60OT/WSxp yQ2XkXudERcOfOxqoXzb4esMyfDkbvr+gneuaOk0IyFnVneD5Y2NZFCxX6/cAI/E UmbLhax9dHVSulMihxgfvr6zicThcxKzyk8wYvi43UIvnUCyZfoJR84S3a+z/y0r EMuNPzFNxZrq2NFOzq2C8bmVkvjWjrdZIJKNTpL63bFLpWufw3KaNAEJuXd23Wg2 HRXauZ+TtTubcW2cE+oJfPsZ3c3LKeZQwbPx4LS8dLRJmjrOpNFCytxL0WAOymH+ f8pYbFep0QsvC6SHlvwZAChixz49qZ2Wc8sC4GmjNZd0W0Nsl8peq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0YirFqM+Quclq sxs6arMG3FucQE8or1/FC7lRtKdCSZbF2kRzMxLsXlJ2HVQlOkYlDIS1blMMawcl 9KoRcQR9WcF38zGH5qb34odSByCzF4FhAoIBAEdlPXGsr8kYFWM3SRkPEfMu9WTC cFXSo86IltWIxUJwQjDeti+ocf93e179WUpQCteU6laMa1CKKepA2CpcQIEDG1ki 16TMeSaE5I5NOeERwioRwt+xSlF51FmaKmSaLIF1AZyg+VjECGJFK+KBTh0AGjGY nakUK1l0M+vIA/Qp1hrfw0mJCMNB3mx+xYvBQuGMI13f5kz5otUTaSGtIqAb3Txv b9UzeLalwn4ulxZL2PX74/eC/dC6J1UzaTL8td6mELihlyuf2HU0fKfT+feQhgfH 4DDo24cbRHxTmbGd4qbaxcskowfeLNDubZ21MpEb93nt246VH/AFHSp1gXU= -----END RSA PRIVATE KEY----- ``` ## 3.1 - Quelle est la commande utilisée ? ` openssl genrsa -out private.pem 4096 ` ## 3.2 - Quel(s) composant(s) contenu(s) dans ce fichier doi(ven)t rester à l'usage exclusif du propriétaire du bi-clé afin de garantir l'intégrité, l'authenticité et la confidentialité des échanges qu'il protège ? - [ ] modulus - [ ] publicExponent - [x] privateExponent - [x] prime1 p - [x] prime2 q - [x] exponent1 - [x] exponent2 - [x] coefficient # 4 - Signature Avec la commande "rsautl" calculez la signature électronique du fichier précédent texte.hash avec l'identité "SRS 2021-2022" et stockez-la dans un fichier nommé texte.sig. ## 4.1 - Quelle est la commande ? ``` openssl rsautl -in texte.hash -out texte.sig -inkey private.pem ``` ## 4.2 - Quelle signature obtenez-vous ? (fournir la représentation hexadécimale sans espace de la signature) ``` 60657f2ebe8228ec15ad89667640b656413e4b95955a13b82d9d5ca02f864706ee2346d13de644a03bc3bbcd7b5ed42cc9c63579d8ea8a9d5b4ce428e1e205a250e8e421bb3252229d4e802a655e5230bfebbb343387185cea841082cfd70b6e4ffdf6a14a05c2b47010a42a2dcd3b44362515d901f7a4c91c5dd242af5f8c1e57e554ec248322535266163731154e9ca10fd040d20982aac80810cec36235e473ee87203e9b2f33a7500c166de62fcafc4c9f474252fd4a56bd8ff7af03527f843517aa00d790f58c881b3828a6a862636f4c5ff7cc76a69c6985b44bee31937e41d234f443e30bc674dc940cdfee1abe899f4cb2065b78fae50d83075b338f401c3411d47278b7bc9fe3f1cf5082190a7a1362353e2121fbcf5a59f34bc881a67c6a937746ba4f22dc3bfe2facb614da310a9c2de517021ac55eea820c7af4ba24b9214247f44666fd8ee3d19cadfec8cb9fae1694255a5ac23676582cd32b0060b66691f0203004522df8b220aec0353b2e9ab8b450085a64a554464c97a1b4afadfe837412a75e1e9225178a296f4c5afef6f98043b23b78c361c5aa6c5ae903ad70fbeda43aa13bd58c68890d0755661574f0d0bcfa6f2fd2352814d9a4fc20c4b9bcbe0c4aa2d5c212fc9eb9322feddfed787080e600a8d1de25b2c97b05396375699051211e6c380196275c83a8a3a06044461235ea18f8e85984332a ``` ## 4.3 - Quelle signature obtenez-vous ? (fournir la signature encodée au format base64) ``` YGV/Lr6CKOwVrYlmdkC2VkE+S5WVWhO4LZ1coC+GRwbuI0bRPeZEoDvDu817XtQsycY1edjqip1bTOQo4eIFolDo5CG7MlIinU6AKmVeUjC/67s0M4cYXOqEEILP1wtuT/32oUoFwrRwEKQqLc07RDYlFdkB96TJHF3SQq9fjB5X5VTsJIMiU1JmFjcxFU6coQ/QQNIJgqrICBDOw2I15HPuhyA+my8zp1AMFm3mL8r8TJ9HQlL9Sla9j/evA1J/hDUXqgDXkPWMiBs4KKaoYmNvTF/3zHamnGmFtEvuMZN+QdI09EPjC8Z03JQM3+4avomfTLIGW3j65Q2DB1szj0AcNBHUcni3vJ/j8c9QghkKehNiNT4hIfvPWlnzS8iBpnxqk3dGuk8i3Dv+L6y2FNoxCpwt5RcCGsVe6oIMevS6JLkhQkf0Rmb9juPRnK3+yMufrhaUJVpawjZ2WCzTKwBgtmaR8CAwBFIt+LIgrsA1Oy6auLRQCFpkpVRGTJehtK+t/oN0EqdeHpIlF4opb0xa/vb5gEOyO3jDYcWqbFrpA61w++2kOqE71YxoiQ0HVWYVdPDQvPpvL9I1KBTZpPwgxLm8vgxKotXCEvyeuTIv7d/teHCA5gCo0d4lssl7BTljdWmQUSEebDgBlidcg6ijoGBERhI16hj46FmEMyo= ``` # 5 - Vérification de la signature Avec la commande "rsautl", vérifiez la signature sur le fichier texte.sig. ## 5.1 - Quelle est la commande ? ``` openssl rsautl -verify -in texte.sig -inkey certificate.crt -certin ``` ## 5.2 - À ce stade, avez-vous réellement vérifié l'authenticité de la signature électronique du fichier texte.txt ? - [x] Oui - [ ] Non ## 5.3 - Justifiez PLEINEMENT votre réponse # 6 - Encodage des fichiers ## 6.1 - Quel standard de structure de données est utilisé pour représenter les clés privées et les certificats x509 ? ASN.1 ## 6.2 - Avec la commande appropriée d'OpenSSL, affichez le certificat dans ce format et décrivez le : ``` 0:d=0 hl=4 l=1404 cons: SEQUENCE 4:d=1 hl=4 l= 868 cons: SEQUENCE 8:d=2 hl=2 l= 3 cons: cont [ 0 ] 10:d=3 hl=2 l= 1 prim: INTEGER :02 13:d=2 hl=2 l= 8 prim: INTEGER :01266E97F56D9805 23:d=2 hl=2 l= 13 cons: SEQUENCE 25:d=3 hl=2 l= 9 prim: OBJECT :sha256WithRSAEncryption 36:d=3 hl=2 l= 0 prim: NULL 38:d=2 hl=2 l= 126 cons: SEQUENCE 40:d=3 hl=2 l= 11 cons: SET 42:d=4 hl=2 l= 9 cons: SEQUENCE 44:d=5 hl=2 l= 3 prim: OBJECT :countryName 49:d=5 hl=2 l= 2 prim: PRINTABLESTRING :FR 53:d=3 hl=2 l= 14 cons: SET 55:d=4 hl=2 l= 12 cons: SEQUENCE 57:d=5 hl=2 l= 3 prim: OBJECT :localityName 62:d=5 hl=2 l= 5 prim: PRINTABLESTRING :Paris 69:d=3 hl=2 l= 14 cons: SET 71:d=4 hl=2 l= 12 cons: SEQUENCE 73:d=5 hl=2 l= 3 prim: OBJECT :organizationName 78:d=5 hl=2 l= 5 prim: PRINTABLESTRING :EPITA 85:d=3 hl=2 l= 19 cons: SET 87:d=4 hl=2 l= 17 cons: SEQUENCE 89:d=5 hl=2 l= 3 prim: OBJECT :organizationalUnitName 94:d=5 hl=2 l= 10 prim: UTF8STRING :EPITA_ELSI 106:d=3 hl=2 l= 29 cons: SET 108:d=4 hl=2 l= 27 cons: SEQUENCE 110:d=5 hl=2 l= 3 prim: OBJECT :commonName 115:d=5 hl=2 l= 20 prim: PRINTABLESTRING :Racine TP EPITA ELSI 137:d=3 hl=2 l= 27 cons: SET 139:d=4 hl=2 l= 25 cons: SEQUENCE 141:d=5 hl=2 l= 9 prim: OBJECT :emailAddress 152:d=5 hl=2 l= 12 prim: IA5STRING :srs@epita.fr 166:d=2 hl=2 l= 30 cons: SEQUENCE 168:d=3 hl=2 l= 13 prim: UTCTIME :211130164200Z 183:d=3 hl=2 l= 13 prim: UTCTIME :221130164200Z 198:d=2 hl=2 l= 98 cons: SEQUENCE 200:d=3 hl=2 l= 11 cons: SET 202:d=4 hl=2 l= 9 cons: SEQUENCE 204:d=5 hl=2 l= 3 prim: OBJECT :countryName 209:d=5 hl=2 l= 2 prim: PRINTABLESTRING :FR 213:d=3 hl=2 l= 14 cons: SET 215:d=4 hl=2 l= 12 cons: SEQUENCE 217:d=5 hl=2 l= 3 prim: OBJECT :localityName 222:d=5 hl=2 l= 5 prim: PRINTABLESTRING :PARIS 229:d=3 hl=2 l= 14 cons: SET 231:d=4 hl=2 l= 12 cons: SEQUENCE 233:d=5 hl=2 l= 3 prim: OBJECT :organizationName 238:d=5 hl=2 l= 5 prim: PRINTABLESTRING :EPITA 245:d=3 hl=2 l= 22 cons: SET 247:d=4 hl=2 l= 20 cons: SEQUENCE 249:d=5 hl=2 l= 3 prim: OBJECT :commonName 254:d=5 hl=2 l= 13 prim: PRINTABLESTRING :SRS 2021-2022 269:d=3 hl=2 l= 27 cons: SET 271:d=4 hl=2 l= 25 cons: SEQUENCE 273:d=5 hl=2 l= 9 prim: OBJECT :emailAddress 284:d=5 hl=2 l= 12 prim: IA5STRING :srs@epita.fr 298:d=2 hl=4 l= 546 cons: SEQUENCE 302:d=3 hl=2 l= 13 cons: SEQUENCE 304:d=4 hl=2 l= 9 prim: OBJECT :rsaEncryption 315:d=4 hl=2 l= 0 prim: NULL 317:d=3 hl=4 l= 527 prim: BIT STRING 848:d=2 hl=2 l= 26 cons: cont [ 3 ] 850:d=3 hl=2 l= 24 cons: SEQUENCE 852:d=4 hl=2 l= 9 cons: SEQUENCE 854:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Basic Constraints 859:d=5 hl=2 l= 2 prim: OCTET STRING [HEX DUMP]:3000 863:d=4 hl=2 l= 11 cons: SEQUENCE 865:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Key Usage 870:d=5 hl=2 l= 4 prim: OCTET STRING [HEX DUMP]:03020640 876:d=1 hl=2 l= 13 cons: SEQUENCE 878:d=2 hl=2 l= 9 prim: OBJECT :sha256WithRSAEncryption 889:d=2 hl=2 l= 0 prim: NULL 891:d=1 hl=4 l= 513 prim: BIT STRING ``` ``` - Les lignes commencent avec son offset en decimal. - d=XX informe sur la profondeur de l'objet, celui-ci augmentant à l'intérieur de tous les SET et SEQUENCE. - hl=XX donne la taille des headers. - l=XX donne la taille du contenu ``` ## 6.3 - Quelle est la différence entre le format PEM et le format DER ? Les certificats PEM sont au format texte codé en Base64 tandis que DER est un format de certificat binaire. # 7 - Certificat auto-signé Générez une bi-clé et un certificat auto-signé au nom de votre trinôme. ``` openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -subj "/C=FR/L=Paris/O=EPITA/OU=SRS/CN=THIERCELIN-RIVOIRE-GALKIEWICZ-LEROY/emailAddress=augustin.thiercelin@epita.fr" ``` Pour la suite, remplacez PRENOM1, NOM1, NOM2 et NOM3 par votre prénom et nom de famille. Le porteur du certificat doit être du type : "C=FR, L=Paris, O=EPITA, OU=SRS, CN=NOM1-NOM2-NOM3, emailAddress=PRENOM1.NOM1@epita.fr". 🚧Le KeyUsage du certificat doit être signature électronique (NonRepudiation) 🚧 ## 7.1 - Quelle est la commande pour générer la bi-clé et le certificat ? ``` openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -subj "/C=FR/L=Paris/O=EPITA/OU=SRS/CN=THIERCELIN-RIVOIRE-GALKIEWICZ-LEROY/emailAddress=augustin.thiercelin@epita.fr" ``` ## 7.1 bis - Si vous avez utilisé un fichier de configuration, mettez son contenu ici. ## 7.2 - Quel est l'émetteur de votre certificat ? Reportez ici sa valeur. ``` THIERCELIN-RIVOIRE-GALKIEWICZ-LEROY ``` ## 7.3 - Créez un conteneur PKCS#12 en y mettant votre certificat et votre clé privée. Reportez ici la commande utilisée ``` openssl pkcs12 -export -out cert.p12 -inkey key.pem -in cert.pem -passout pass:BonjourMonsieurSiVousVoyezCeMessageProuvezNousQueVousLisezLesTPEnPortantUnChapeauMelonAuProchainCours ``` # 8 - Signature XAdES (Simple) Ces exercices sont à réaliser avec l'outil ATEXO CoSign v4 ou avec un autre outil (en ligne ou pas). L'outil ATEXO CoSign v4 est disponible à cette adresse : https://www.dropbox.com/s/eeyc2m2lhlgbhvk/ATEXO-CoSign-v4.2.1.jar?dl=1 ATEXO CoSign fonctionne sous MacOS et Windows. Sous Linux, il l'outil n'accède a priori pas au magasin de certificats, nécessaire pour réaliser une signature. Pour cette partie du TP, vous devez importer le conteneur PKCS#12 généré dans la section précédente dans votre trousseau/magasin de certificats (différent selon l'OS utilisé). Une fois votre certificat et votre clé privée bien importés, vous pouvez passer à la suite, et utiliser cette identité pour la suite du TP. ## 8.1 - Signature d'un document Réalisez la signature électronique au format XAdES du fichier texte.txt avec l'identité que vous venez de générer, et stockez-la dans un fichier nommé texte_sig_xades.xml. Ouvrez le fichier texte_sig_xades.xml à l'aide d'un éditeur ou d'un visualisateur de document XML. Il est conseillé de travailler sur une version indentée de ce fichier pour plus de simplicité de lecture (tout en conservant l'original). ## 8.2 - Combien de hash se trouve dans ce fichier de signature ? - [ ] 1 - [x] 3 - [ ] 4 # 9. Hash du fichier signé ``` CtztIF3vtDQSIDrVA63qIXNOz47ch/qQZsemfGhhRPkklAzq+I6kTHfqM2FOkkvY/TYzcppEEjom qnCMk5b/2cGzA0WMgdFWpg0N+vJKJTFZ4nOjbd5Si2kWab4J0/CbfhIkXtKuoRlaFgLo/s9lXMr4 VG7MopWU03CAQb+C3uOIm3gUUzWQcyd8CUH9wJxgxrZj+XnRbA2oZve8nhrLsLBIwU5gfPkLj9Vx odVU30SHdjYr9J9f2AXO+P6GIY40RukYhEavAvys1BpGHaS4rFguIcUJBM588P0Ee66VzRAxtiQw Rxib2WZst2e5QeD2iv4dPNzJ5a5w9a0auz5VH0YjgVI7b/yNFYe3nVeTwXQlE61RgmtnggpdVEHK xmHrfq1yAFmA8eZeDtAXfZey1P7mtqAYQf2IsKPtfrUf5nw+lanK1uXMKGJeFwQb+ABNcyPrzAEV 8xAsrWHsVB+/IBA6sZAUCIZnTx7gsIlPqgWEUGdETDhVn7PsKMmqaUT2WeDBaOUgzKS/MGyrFT6a DnotKHkiGkH56Jvp2gcX/R2YweDboLIxObCTIkRpqOR3fYFuxHlcUReqUaBRUbrQnUBjSOintJTr ItnYwcKqhcoE00itVj/9nUoBaE/BE/rWXdvkamsfMKqpHvICwSZgIB0CZ+RaAlKQ/fLJJmFtqvc= ``` ## 9.1 - Quel est le hash du fichier signé ? (Fournir le hash encodé au format base64) ## 9.2 - Reproduisez ce hash à l'aide d'une commande shell script. Quelle est la commande ? # 10. Analyse de la signature ## 10.1 - Quel est le second hash ? (Fournir le hash encodé au format base64) ## 10.2 - A quelle(s) donnée(s) correspond-il ? ## 10.3 - Quelles données sont signées ? # 11 - Validité d'un certificat électronique -----BEGIN X509 CRL----- MIIDPjCCASYCAQEwDQYJKoZIhvcNAQELBQAwfjELMAkGA1UEBhMCRlIxDjAMBgNV BAcTBVBhcmlzMQ4wDAYDVQQKEwVFUElUQTETMBEGA1UECwwKRVBJVEFfRUxTSTEd MBsGA1UEAxMUUmFjaW5lIFRQIEVQSVRBIEVMU0kxGzAZBgkqhkiG9w0BCQEWDHNy c0BlcGl0YS5mchcNMjExMjAxMTMxOTAwWhcNMjExMjMxMTMxOTAwWjBDMEECCAEm bpf1bZgFFw0yMTEyMDExMzE5MDhaMCYwGAYDVR0YBBEYDzIwMjExMjAxMTMxODAw WjAKBgNVHRUEAwoBAaAvMC0wHwYDVR0jBBgwFoAUS68nqT5OfyEd0ncegB1NQZeN I5AwCgYDVR0UBAMCAQEwDQYJKoZIhvcNAQELBQADggIBAAHbkU4VbBgvE+9n2ByZ YyQyTIB4k4wYajeZMR3nOk2V00lfWbYa9kOyJPotwctyV2Ny0raKVUh/XGtUhQh8 kkMc1hGTpKTD1FknQcAvKA22wFfAtw+7kZRFhVf5Nv/5ING5OUa16cNV3dL7NYXp jXSteTWt0rUQ7rWZXfJeQ0ajFqt6MeXtcXCD1qqEVATyYQCfphNuBkdXMcNjLJJv WCvcLkDXvepgNzxqKXkbzFNPlMCP+t4BUwmTa4vbX+fMloCW+msZ/MOATfWmgBxr 5XHmjRQ0Au/Z4zunMxy53CTZ+mmS3n7ZVPRnSO6kbbln9u+vsv9V9EYYLr7uaz+n Fk5m9oRRXx5IATukZfesnQ5nt2KAi3pKEdzOdTHe3du2zYxwlnN5cvvXQlzpew1t C0DIFMtnVoWKKSjM35DxkGgBz0MHLS8rCQuGGlq8774jWdbyNB+DKWinIpdzMNma Mk9mEtE+re4CIjwNsuIQ2vychcsU0gNMmQi+x/2u917ksR7TSmyWiF1rfDx94c+U FPTM3ym6vtg3tLdOga9+z4BgA2CsnVolczPBnFeHfao8CBU/XoP/CuqgUXHNyL/P 4PG1U7LZ71KNAyaXPJktX2L85JrIdm/hpJizJH9TSWJeO3d9WxAZY/DcEO2orTC/ zXGIpE7ijhyufjG7o242icq4 -----END X509 CRL----- ## 11.1 - Quelle est la commande utilisée ? ``` openssl crl -text -noout -in crl.crl ``` ## 11.2 - Quelles informations sont présentes dans la CRL ? - [ ] Numéros de séries des certificats valides - [x] Numéros de séries des certificats révoqués - [ ] Numéros de séries des certificats expirés - [ ] Clé privée de l'autorité Racine - [ ] Clé publique de l'autorité Racine - [ ] Date de fin de validité de l'autorité Racine - [ ] Date de fin de validité de la CRL - [x] La raison de la révocation ## 11.3 - La CRL contient une signature. Qui en est l'émetteur (qui a effectué cette signature) ? - [ ] SRS 2021-2022 - [x] Racine TP EPITA ELSI - [ ] Autre : ## 11.4 - La CRL est un moyen d'obtenir le statut de validité d'un certificat (révoqué, suspendu, valide). Pouvez-vous maintenant confirmer que la signature réalisée au §4 est valide ? - [x] Oui - [ ] Non ## 11.5 - Expliquez ce choix ``` La signature du certificat utilisé pour la signature dans la question 4 ne possede pas la meme signature que le certificat qui semble etre revoqué dans la CRL. ``` # 12 - Online Certificate Status Protocol (OCSP) L'OCSP est une autre méthode permettant d'obtenir le statut d'un certificat. Contrairement à la CRL qui est un fichier à récupérer, l'OCSP est un service en ligne interrogeable. A l'aide de la commande openssl "ocsp", vérifiez le statut du certificat du site : https://www.epita.it/. Aide pour l'interrogation d'un service OCSP Plusieurs informations doivent être récupérées à partir de ce certificat afin de pouvoir interroger le service OCSP : - Le certificat de l'émetteur du certificat : Authority Information Access -> CA Issuers au format PEM (base64 encoded) - L'adresse du répondeur OCSP : Authority Information Access -> OCSP ## 12.1 - Quelle commande avez-vous utilisé ? ``` openssl ocsp -issuer chain.pem -cert cert.pem -text -url http://r3.o.lencr.org ``` ## 12.2 - Collez ici la réponse que vous obtenez du répondeur OCSP ``` OCSP Request Data: Version: 1 (0x0) Requestor List: Certificate ID: Hash Algorithm: sha1 Issuer Name Hash: 48DAC9A0FB2BD32D4FF0DE68D2F567B735F9B3C4 Issuer Key Hash: 142EB317B75856CBAE500940E61FAF9D8B14C2C6 Serial Number: 032706C551C3335445CFACBB96383D5CCADB Request Extensions: OCSP Nonce: 041063C13D6EB8DAE7EC6C314772FC580A07 OCSP Response Data: OCSP Response Status: successful (0x0) Response Type: Basic OCSP Response Version: 1 (0x0) Responder Id: C = US, O = Let's Encrypt, CN = R3 Produced At: Dec 1 02:55:00 2021 GMT Responses: Certificate ID: Hash Algorithm: sha1 Issuer Name Hash: 48DAC9A0FB2BD32D4FF0DE68D2F567B735F9B3C4 Issuer Key Hash: 142EB317B75856CBAE500940E61FAF9D8B14C2C6 Serial Number: 032706C551C3335445CFACBB96383D5CCADB Cert Status: good This Update: Dec 1 02:00:00 2021 GMT Next Update: Dec 8 01:59:58 2021 GMT Signature Algorithm: sha256WithRSAEncryption 5e:a0:64:41:ed:c7:4e:74:f6:11:d9:02:2c:5e:93:d5:94:d5: 58:c1:22:ad:20:57:3b:e7:e6:5e:5e:61:0c:44:fb:ad:c8:0d: 05:1e:e8:70:5c:4e:d1:48:55:bb:71:34:a7:33:b5:dc:f8:41: 6c:2e:cc:8f:94:06:bb:88:70:45:3b:77:96:f1:83:85:bc:e2: a3:16:44:f3:cf:fa:45:4d:1c:39:af:97:21:57:a3:4f:dd:d4: 81:93:9a:be:19:76:c1:28:ba:08:16:56:75:e6:f3:5a:8f:d3: 54:51:2d:c6:e8:cb:89:dc:f1:a1:cc:de:84:19:54:d8:44:9e: 8f:0e:21:b7:76:36:fb:65:bc:45:57:a8:3d:e6:b5:f5:93:a7: ec:3a:72:dc:a6:fb:35:40:be:70:2a:dd:d8:d6:5e:d3:09:14: 75:a4:12:06:c1:dc:41:5c:88:75:a0:9d:da:46:a9:23:02:15: 70:ef:a8:43:d6:e2:e6:b1:07:8e:c8:4f:bf:9c:65:92:f1:c8: f5:1a:91:46:22:12:e9:d6:b0:46:e5:8d:de:7b:d8:cb:62:8d: c9:b1:90:17:7e:75:c9:ea:fc:1a:2d:2f:f4:49:0e:ec:e4:95: af:2a:9a:a7:c5:9a:9f:94:0d:b7:63:db:45:c0:02:c9:6b:5b: a0:0d:78:cd WARNING: no nonce in response Response verify OK cert.pem: good This Update: Dec 1 02:00:00 2021 GMT Next Update: Dec 8 01:59:58 2021 GMT ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully