Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Digital Signature in Windows: Ensuring Authenticity and Integrity of Digital Documents

In today's digital age, where electronic documents are widely used, ensuring the authenticity and integrity of these documents is crucial. Digital signatures play a vital role in achieving this objective by providing a way to verify the identity of the sender and ensuring that the document has not been tampered with during transmission. This article aims to explain the concept of digital signatures and how they can be implemented in the Windows environment to ensure the security of digital documents.


Examples:
1. Generating a Digital Signature using PowerShell:


$certificate = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where-Object { $_.Subject -like "*Your Name*" }
$hashAlgorithm = [System.Security.Cryptography.HashAlgorithmName]::SHA256
$signatureAlgorithm = [System.Security.Cryptography.X509Certificates.X509ContentType]::Pkcs7
$signedData = New-Object System.Security.Cryptography.SignedCms -ArgumentList (Get-Content -Path "C:\Path\To\File.pdf")
$signedData.ComputeSignature($hashAlgorithm, $certificate)
$signatureBytes = $signedData.Encode($signatureAlgorithm)
$signatureBytes | Out-File -FilePath "C:\Path\To\Signature.p7s"

2. Verifying a Digital Signature using PowerShell:


$signatureBytes = Get-Content -Path "C:\Path\To\Signature.p7s" -Encoding Byte
$signedData = New-Object System.Security.Cryptography.SignedCms
$signedData.Decode($signatureBytes)
$signedData.CheckSignature([System.Security.Cryptography.X509Certificates.X509Certificate2]::CreateFromCertFile("C:\Path\To\PublicCertificate.cer"), $true)

To share Download PDF