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
reseau:cloud:azure:configurerapppoursharepoint [2026/04/10 22:08] – [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 160: 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) ===
  
  
Ligne 181: Ligne 181:
    -CertStoreLocation Cert:\CurrentUser\My `      -CertStoreLocation Cert:\CurrentUser\My `  
    -Password (ConvertTo-SecureString -String "MotDePasseFort123!" -AsPlainText)    -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> </code>
  
reseau/cloud/azure/configurerapppoursharepoint.1775851683.txt.gz · Dernière modification : 2026/04/10 22:08 de techer.charles_educ-valadon-limoges.fr