Outils pour utilisateurs

Outils du site


reseau:cloud:azure:configurerapppoursharepoint

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
reseau:cloud:azure:configurerapppoursharepoint [2026/04/10 22:02] – [Utilisation d'un certificat] techer.charles_educ-valadon-limoges.frreseau:cloud:azure:configurerapppoursharepoint [2026/04/10 22:24] (Version actuelle) – [Utilisation d'un certificat] techer.charles_educ-valadon-limoges.fr
Ligne 123: Ligne 123:
 $cert.HasPrivateKey doit renvoyer True $cert.HasPrivateKey doit renvoyer True
  
-   +=== Export du certificat PUBLIC (.cer) à importer dans Entra ID ===
-Export du certificat PUBLIC (.cer) à importer dans Entra ID+
  
 <code> <code>
Ligne 161: Ligne 160:
 </code> </code>
  
-    * exporter le certificat pour obtenir un PFX (clé privée incluse)+=== Exporter le certificat pour obtenir un PFX PKCS#(clé privée incluse) === 
  
 <code> <code>
Ligne 173: Ligne 173:
   -Password (ConvertTo-SecureString -String "MotDePasseFort123!" -AsPlainText -Force)   -Password (ConvertTo-SecureString -String "MotDePasseFort123!" -AsPlainText -Force)
 </code> </code>
 +
 +=== Importer un PFX sur une autre machine ===
 +
 +<code>
 +Import-PfxCertificate `
 +   -FilePath "fichier.pfx" `
 +   -CertStoreLocation Cert:\CurrentUser\My `  
 +   -Password (ConvertTo-SecureString -String "MotDePasseFort123!" -AsPlainText)
 +</code>
 +
 +=== Générer une clé PKCS#8 ===
 +
 +  * Recharger le PFX 
 +
 +<code>
 +$pfxPath = "c:\temp\fichier.pfx"
 +$pfxPassword = "TempPfxPassword!ChangeMe"
 +
 +$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2(
 +    $pfxPath,
 +    $pfxPassword,
 +    [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable
 +)
 +</code>
 +
 + * Récupérer la clé privée RSA
 +
 +<code>
 +$rsa = $cert.PrivateKey
 +</code>
 +
 +  * Exporter la clé AU FORMAT PKCS#8
 +
 +<code>
 +# Récupère les paramètres
 +$params = $rsa.ExportParameters($true)
 +
 +# Crée un RSA moderne
 +$rsa2 = [System.Security.Cryptography.RSA]::Create()
 +$rsa2.ImportParameters($params)
 +
 +# Export PKCS#8
 +$pkcs8 = $rsa2.ExportPkcs8PrivateKey()
 +
 +$base64 = [System.Convert]::ToBase64String(
 +    $pkcs8,
 +    [System.Base64FormattingOptions]::InsertLineBreaks
 +)
 +
 +
 +$pem = @"
 +-----BEGIN PRIVATE KEY-----
 +$base64
 +-----END PRIVATE KEY-----
 +"@
 +
 +$pem | Set-Content `
 +  -Path C:\Temp\fichier.key `
 +  -Encoding ASCII
 +</code>
 +
 +=== Résumé .cer .pfx ===
  
 <WRAP center round info> <WRAP center round info>
reseau/cloud/azure/configurerapppoursharepoint.1775851375.txt.gz · Dernière modification : 2026/04/10 22:02 de techer.charles_educ-valadon-limoges.fr