Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell Asymmetric Encryption test

$
0
0

From the Powershell console, I enter the following 4 lines one at a time.

$rsa = New-Object System.Security.Cryptography.RSACryptoServiceProvider(1024)

$PrivateKey = $rsa.ToXmlString($true)

$PublicKey = $rsa.ToXmlString($false)

$OriginalText = "Now is the time."

How do I test encrypting and decrypting?

The next 2 lines are pseudo code:

$EncryptedText = $rsa.Encrypt($OriginalText, $PrivateKey)

$DecryptedText = $rsa.Decrypt($EncryptedText, $PublicKey)

Sorry if this is not what the intended use was for asymmetric encryption. But I like the idea of being able to encrypt a string with one key and decrypt it with another.

Thank you for your help.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>