Проверка сертификата
param($cert, [switch]$help) function funHelp() { $helpText=@" DESCRIPTION: NAME: InspectCertificate.ps1 Finds certificates of a particular use on the local machine PARAMETERS: -cert the full path to the certificate to inspect -help prints help file SYNTAX: InspectCertificate.ps1 Generates an error that a certificate is required InspectCertificate.ps1 -cert "c:\fso\filerecovery.cer" Inspects a certificate called filerecovery in the c:\fso directory. This certificate could be DER encoded or base -64 encoded .cer file. InspectCertificate.ps1 -help Prints the help topic for the script "@ $helpText exit } if($help) { "Printing help now..." ; funHelp } if(!$cert) { "A certificate is required..." ; funHelp } $objCert=[security.cryptography.x509certificates.x509certificate]"$cert" "HashString: $($objCert.GetCertHashString())" "EffectiveDate: $($objCert.GetEffectiveDateString())" "ExpirationDate: $($objCert.GetExpirationDateString())" "HashCode: $($objCert.GetHashCode())" "KeyAlgorithm: $($objCert.GetKeyAlgorithm())" "KeyAlgorithmParameters: $($objCert.GetKeyAlgorithmParametersString())" "Name: $($objCert.GetName())`n" "PublicKey: $($objCert.GetPublicKeyString())`n" "RawCertData: $($objCert.GetRawCertDataString())`n" "SerialNumber: $($objCert.GetSerialNumberString())" "Cert: $($objCert.ToString())" "Issuer: $($objCert.Issuer)" "Subject: $($objCert.Subject)"
Голосов пока нет
Оставить комментарий