encryption - Using CreateDecryotor() in PowerShell -
I was thinking that someone could help me with the error found in PowerShell. I'm not having any problems with making the encryptor shown below:
$ crypto = New-object System.Security.Cryptography.RNGCryptoServiceProvider $ IV = New-Object System.Byte [] 16 $ crypto GetNonZeroBytes ($ iv) $ RIJSym = New-Item System.Security.Cryptography.RijndaelManaged [Byte []] $ key = ('mysecret $% @'). ToCharArray () $ encryptor = $ RIJSym.CreateEncryptor ($ key, $ 4) But when I want to decrypt my key, I have a problem for any reason This is what I am using and when I run the program I get:
$ decrypted = $ RIJSym.CreateDecryptor ($ encryptor) Error message
can not find an overload for "CreateDecryptor" and logic number: "1" 15 four: $ 1 $ $ DeCryp = $ rijSym.CreateDecryptor ($ en Cryptor) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId: MethodCountCouldNotFindBest
error Says ... CreateDecryptor () does not charge a surcharge uses a single logic. Valid surcharges are as follows: PS & gt; $ RIJSym.CreateDecryptor OverloadDefinitions ------------------- System.Security.Cryptography.ICryptoTransform CreateDecryptor (Byte [] rgbKey, Byte [] rgbIV) System.Security.Cryptography.ICryptoTransform CreateDecryptor () You need to create a decryptor in the same manner to create an encryptor: specifying the key and fourth, the former. $ decrypted = $ RIJSym.CreateDecryptor ($ key, $ IV)
Comments
Post a Comment