25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

26 satır
877B

  1. param([Parameter(Mandatory = $true)][string]$ConfigPath)
  2. $ErrorActionPreference = 'Stop'
  3. . (Join-Path $PSScriptRoot 'mail-common.ps1')
  4. $context = Get-MailContext -ConfigPath $ConfigPath
  5. foreach ($testNumber in 1, 2) {
  6. $synthetic = [guid]::NewGuid().ToString('N')
  7. $password = ConvertTo-SecureString -String $synthetic -AsPlainText -Force
  8. try {
  9. Save-SmtpPassword -Context $context -Password $password
  10. $loaded = Load-SmtpPassword -Context $context
  11. try {
  12. $credential = New-Object System.Net.NetworkCredential -ArgumentList @('test', $loaded)
  13. if ($credential.Password -cne $synthetic) { throw 'Protected password round trip failed' }
  14. }
  15. finally {
  16. $loaded.Dispose()
  17. }
  18. }
  19. finally {
  20. $password.Dispose()
  21. }
  22. }
  23. Write-Output 'DPAPI password save, load, and rotation passed'

Powered by TurnKey Linux.